Run pgindent.
authorTatsuo Ishii <ishii@postgresql.org>
Thu, 17 Jul 2025 10:15:48 +0000 (19:15 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Thu, 17 Jul 2025 10:15:48 +0000 (19:15 +0900)
148 files changed:
src/auth/auth-scram.c
src/auth/pool_auth.c
src/auth/pool_hba.c
src/auth/pool_passwd.c
src/config/pool_config_variables.c
src/context/pool_process_context.c
src/context/pool_query_context.c
src/context/pool_session_context.c
src/include/auth/pool_auth.h
src/include/auth/pool_hba.h
src/include/auth/pool_passwd.h
src/include/auth/scram-common.h
src/include/auth/scram.h
src/include/context/pool_process_context.h
src/include/context/pool_query_context.h
src/include/context/pool_session_context.h
src/include/main/health_check.h
src/include/main/pgpool_logger.h
src/include/main/pool_internal_comms.h
src/include/parser/explain.h
src/include/parser/extensible.h
src/include/parser/gramparse.h
src/include/parser/nodes.h
src/include/parser/parsenodes.h
src/include/parser/parser.h
src/include/parser/pg_class.h
src/include/parser/pg_list.h
src/include/parser/pg_trigger.h
src/include/parser/pg_wchar.h
src/include/parser/pool_parser.h
src/include/parser/scanner.h
src/include/pcp/libpcp_ext.h
src/include/pcp/pcp.h
src/include/pcp/pcp_stream.h
src/include/pcp/pcp_worker.h
src/include/pcp/recovery.h
src/include/pool.h
src/include/pool_config.h
src/include/pool_config_variables.h
src/include/pool_type.h
src/include/protocol/pool_connection_pool.h
src/include/protocol/pool_pg_utils.h
src/include/protocol/pool_process_query.h
src/include/protocol/pool_proto_modules.h
src/include/query_cache/pool_memqcache.h
src/include/rewrite/pool_lobj.h
src/include/rewrite/pool_timestamp.h
src/include/utils/elog.h
src/include/utils/fe_ports.h
src/include/utils/getopt_long.h
src/include/utils/json.h
src/include/utils/json_writer.h
src/include/utils/memutils.h
src/include/utils/palloc.h
src/include/utils/pool_ip.h
src/include/utils/pool_params.h
src/include/utils/pool_process_reporting.h
src/include/utils/pool_relcache.h
src/include/utils/pool_select_walker.h
src/include/utils/pool_ssl.h
src/include/utils/pool_stream.h
src/include/utils/ps_status.h
src/include/utils/regex_array.h
src/include/utils/sha2.h
src/include/utils/ssl_utils.h
src/include/utils/statistics.h
src/include/utils/timestamp.h
src/include/version.h
src/include/watchdog/watchdog.h
src/include/watchdog/wd_commands.h
src/include/watchdog/wd_internal_commands.h
src/include/watchdog/wd_ipc_conn.h
src/include/watchdog/wd_ipc_defines.h
src/include/watchdog/wd_json_data.h
src/include/watchdog/wd_lifecheck.h
src/include/watchdog/wd_utils.h
src/libs/pcp/pcp.c
src/main/health_check.c
src/main/main.c
src/main/pgpool_logger.c
src/main/pgpool_main.c
src/main/pool_globals.c
src/main/pool_internal_comms.c
src/parser/copyfuncs.c
src/parser/keywords.c
src/parser/list.c
src/parser/makefuncs.c
src/parser/outfuncs.c
src/parser/parser.c
src/parser/snprintf.c
src/parser/wchar.c
src/pcp_con/pcp_child.c
src/pcp_con/pcp_worker.c
src/pcp_con/recovery.c
src/protocol/CommandComplete.c
src/protocol/child.c
src/protocol/pool_connection_pool.c
src/protocol/pool_pg_utils.c
src/protocol/pool_process_query.c
src/protocol/pool_proto2.c
src/protocol/pool_proto_modules.c
src/query_cache/pool_memqcache.c
src/rewrite/pool_lobj.c
src/rewrite/pool_timestamp.c
src/sql/pgpool-recovery/pgpool-recovery.c
src/sql/pgpool_adm/pgpool_adm.c
src/streaming_replication/pool_worker_child.c
src/test/regression/tests/010.rewrite_timestamp/timestamp/main.c
src/tools/fe_port.c
src/tools/pcp/pcp_frontend_client.c
src/tools/pgenc/pg_enc.c
src/tools/pgmd5/pg_md5.c
src/tools/pgproto/extended_query.c
src/tools/pgproto/main.c
src/tools/pgproto/read.c
src/tools/pgproto/send.c
src/tools/watchdog/wd_cli.c
src/utils/error/elog.c
src/utils/json.c
src/utils/json_writer.c
src/utils/mmgr/aset.c
src/utils/mmgr/mcxt.c
src/utils/pcp/pcp_stream.c
src/utils/pool_health_check_stats.c
src/utils/pool_ip.c
src/utils/pool_params.c
src/utils/pool_path.c
src/utils/pool_process_reporting.c
src/utils/pool_relcache.c
src/utils/pool_select_walker.c
src/utils/pool_shmem.c
src/utils/pool_ssl.c
src/utils/pool_stream.c
src/utils/pqexpbuffer.c
src/utils/ps_status.c
src/utils/regex_array.c
src/utils/ssl_utils.c
src/utils/statistics.c
src/watchdog/watchdog.c
src/watchdog/wd_commands.c
src/watchdog/wd_heartbeat.c
src/watchdog/wd_if.c
src/watchdog/wd_internal_commands.c
src/watchdog/wd_ipc_conn.c
src/watchdog/wd_json_data.c
src/watchdog/wd_lifecheck.c
src/watchdog/wd_ping.c
src/watchdog/wd_utils.c

index 3a0aa71c8c78e998511d3a3f4045eebc08443c33..334e28f33692e69f32b6c0ae70ca821bb68bca3d 100644 (file)
@@ -212,8 +212,8 @@ static char *build_client_first_message(fe_scram_state *state);
 static char *build_client_final_message(fe_scram_state *state);
 static bool verify_server_signature(fe_scram_state *state);
 static void calculate_client_proof(fe_scram_state *state,
-                                          const char *client_final_message_without_proof,
-                                          uint8 *result);
+                                                                  const char *client_final_message_without_proof,
+                                                                  uint8 *result);
 
 static void read_client_first_message(scram_state *state, char *input);
 static void read_client_final_message(scram_state *state, char *input);
@@ -222,9 +222,9 @@ static char *build_server_final_message(scram_state *state);
 static bool verify_client_proof(scram_state *state);
 static bool verify_final_nonce(scram_state *state);
 static bool parse_scram_verifier(const char *verifier, int *iterations,
-                                        char **salt, uint8 *stored_key, uint8 *server_key);
+                                                                char **salt, uint8 *stored_key, uint8 *server_key);
 static void mock_scram_verifier(const char *username, int *iterations,
-                                       char **salt, uint8 *stored_key, uint8 *server_key);
+                                                               char **salt, uint8 *stored_key, uint8 *server_key);
 static bool is_scram_printable(char *p);
 static char *sanitize_char(char c);
 static char *GetMockAuthenticationNonce(void);
@@ -1138,7 +1138,7 @@ build_server_final_message(scram_state *state)
        char       *server_signature_base64;
        int                     siglen;
        scram_HMAC_ctx ctx;
-       char *res;
+       char       *res;
 
        /* calculate ServerSignature */
        scram_HMAC_init(&ctx, state->ServerKey, SCRAM_KEY_LEN);
index 198d8c99e1fa26edc98f0a991443f10033c1743b..8c17db4a71a83f664e3019d225ca31891823fe39 100644 (file)
 #define MAX_SASL_PAYLOAD_LEN 1024
 
 
-static void pool_send_backend_key_data(POOL_CONNECTION * frontend, int pid,
+static void pool_send_backend_key_data(POOL_CONNECTION *frontend, int pid,
                                                                           char *key, int32 keylen, int protoMajor);
-static int     do_clear_text_password(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth, int protoMajor);
-static void pool_send_auth_fail(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * cp);
-static int do_md5(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth, int protoMajor,
-          char *storedPassword, PasswordType passwordType);
-static void send_md5auth_request(POOL_CONNECTION * frontend, int protoMajor, char *salt);
-static int     read_password_packet(POOL_CONNECTION * frontend, int protoMajor, char *password, int *pwdSize);
-static int     send_password_packet(POOL_CONNECTION * backend, int protoMajor, char *password);
-static int     send_auth_ok(POOL_CONNECTION * frontend, int protoMajor);
-static void sendAuthRequest(POOL_CONNECTION * frontend, int protoMajor, int32 auth_req_type, char *extradata, int extralen);
-
-static int     pg_SASL_continue(POOL_CONNECTION * backend, char *payload, int payloadlen, void *sasl_state, bool final);
-static void *pg_SASL_init(POOL_CONNECTION * backend, char *payload, int payloadlen, char *username, char *storedPassword);
-static bool do_SCRAM(POOL_CONNECTION * frontend, POOL_CONNECTION * backend, int protoMajor, int message_length,
-                char *username, char *storedPassword, PasswordType passwordType);
-static void authenticate_frontend_md5(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth, int protoMajor);
-static void authenticate_frontend_cert(POOL_CONNECTION * frontend);
-static void authenticate_frontend_SCRAM(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth);
-static void authenticate_frontend_clear_text(POOL_CONNECTION * frontend);
-static bool get_auth_password(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth,
-                                 char **password, PasswordType *passwordType);
-static void ProcessNegotiateProtocol(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * cp);
+static int     do_clear_text_password(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reauth, int protoMajor);
+static void pool_send_auth_fail(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp);
+static int     do_md5(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reauth, int protoMajor,
+                                  char *storedPassword, PasswordType passwordType);
+static void send_md5auth_request(POOL_CONNECTION *frontend, int protoMajor, char *salt);
+static int     read_password_packet(POOL_CONNECTION *frontend, int protoMajor, char *password, int *pwdSize);
+static int     send_password_packet(POOL_CONNECTION *backend, int protoMajor, char *password);
+static int     send_auth_ok(POOL_CONNECTION *frontend, int protoMajor);
+static void sendAuthRequest(POOL_CONNECTION *frontend, int protoMajor, int32 auth_req_type, char *extradata, int extralen);
+
+static int     pg_SASL_continue(POOL_CONNECTION *backend, char *payload, int payloadlen, void *sasl_state, bool final);
+static void *pg_SASL_init(POOL_CONNECTION *backend, char *payload, int payloadlen, char *username, char *storedPassword);
+static bool do_SCRAM(POOL_CONNECTION *frontend, POOL_CONNECTION *backend, int protoMajor, int message_length,
+                                        char *username, char *storedPassword, PasswordType passwordType);
+static void authenticate_frontend_md5(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reauth, int protoMajor);
+static void authenticate_frontend_cert(POOL_CONNECTION *frontend);
+static void authenticate_frontend_SCRAM(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reauth);
+static void authenticate_frontend_clear_text(POOL_CONNECTION *frontend);
+static bool get_auth_password(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reauth,
+                                                         char **password, PasswordType *passwordType);
+static void ProcessNegotiateProtocol(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp);
 
 /*
  * Do authentication. Assuming the only caller is
  * make_persistent_db_connection().
  */
 void
-connection_do_auth(POOL_CONNECTION_POOL_SLOT * cp, char *password)
+connection_do_auth(POOL_CONNECTION_POOL_SLOT *cp, char *password)
 {
        char            kind;
        int                     length;
@@ -243,8 +243,8 @@ connection_do_auth(POOL_CONNECTION_POOL_SLOT * cp, char *password)
 
                switch (kind)
                {
-                       char    *p;
-                       int32   keylen;
+                               char       *p;
+                               int32           keylen;
 
                        case 'K':                       /* backend key data */
                                keydata_done = true;
@@ -259,7 +259,7 @@ connection_do_auth(POOL_CONNECTION_POOL_SLOT * cp, char *password)
                                {
                                        ereport(ERROR,
                                                        (errmsg("failed to authenticate"),
-                                                        errdetail("invalid backend key data length. received %d bytes exceeding %d", 
+                                                        errdetail("invalid backend key data length. received %d bytes exceeding %d",
                                                                           ntohl(length), MAX_CANCELKEY_LENGTH)));
                                }
 
@@ -332,7 +332,7 @@ connection_do_auth(POOL_CONNECTION_POOL_SLOT * cp, char *password)
  * 0.
 */
 int
-pool_do_auth(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * cp)
+pool_do_auth(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
 {
        signed char kind;
        int                     pid;
@@ -342,9 +342,9 @@ pool_do_auth(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * cp)
        int                     i;
        int                     message_length = 0;
        StartupPacket *sp;
-       int32           keylen; /* cancel key length */
-       char    cancel_key[MAX_CANCELKEY_LENGTH];
-       char            *p;
+       int32           keylen;                 /* cancel key length */
+       char            cancel_key[MAX_CANCELKEY_LENGTH];
+       char       *p;
 
        protoMajor = MAIN_CONNECTION(cp)->sp->major;
 
@@ -484,9 +484,8 @@ read_kind:
                                                          &password, &passwordType) == false)
                {
                        /*
-                        * We do not have any password, we can still get the password
-                        * from client using plain text authentication if it is
-                        * allowed by user
+                        * We do not have any password, we can still get the password from
+                        * client using plain text authentication if it is allowed by user
                         */
                        if (frontend->pool_hba == NULL && pool_config->allow_clear_text_frontend_auth)
                        {
@@ -741,7 +740,7 @@ read_kind:
                }
        }
        else
-                       keylen = 4;
+               keylen = 4;
 
        elog(DEBUG1, "cancel key length: %d", keylen);
 
@@ -821,11 +820,11 @@ read_kind:
 * throws ereport.
 */
 int
-pool_do_reauth(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * cp)
+pool_do_reauth(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
 {
        int                     protoMajor;
        int                     msglen;
-       POOL_CONNECTION_POOL_SLOT       *sp;
+       POOL_CONNECTION_POOL_SLOT *sp;
 
        protoMajor = MAJOR(cp);
 
@@ -900,7 +899,7 @@ pool_do_reauth(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * cp)
 * send authentication failure message text to frontend
 */
 static void
-pool_send_auth_fail(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * cp)
+pool_send_auth_fail(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
 {
        int                     messagelen;
        char       *errmessage;
@@ -925,7 +924,7 @@ pool_send_auth_fail(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * cp)
  * Send backend key data to frontend.
  */
 static void
-pool_send_backend_key_data(POOL_CONNECTION * frontend, int pid,
+pool_send_backend_key_data(POOL_CONNECTION *frontend, int pid,
                                                   char *key, int32 keylen, int protoMajor)
 {
        char            kind;
@@ -946,7 +945,7 @@ pool_send_backend_key_data(POOL_CONNECTION * frontend, int pid,
 }
 
 static void
-authenticate_frontend_clear_text(POOL_CONNECTION * frontend)
+authenticate_frontend_clear_text(POOL_CONNECTION *frontend)
 {
        static int      size;
        char            password[MAX_PASSWORD_SIZE];
@@ -1033,7 +1032,7 @@ authenticate_frontend_clear_text(POOL_CONNECTION * frontend)
  * perform clear text password authentication
  */
 static int
-do_clear_text_password(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth, int protoMajor)
+do_clear_text_password(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reauth, int protoMajor)
 {
        static int      size;
        char       *pwd = NULL;
@@ -1066,17 +1065,16 @@ do_clear_text_password(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, in
        else if (!rtn || frontend->pwd_size == 0)
        {
                /*
-                * We do not have any password, we can still get the password
-                * from client using plain text authentication if it is
-                * allowed by user
+                * We do not have any password, we can still get the password from
+                * client using plain text authentication if it is allowed by user
                 */
 
                if (frontend->pool_hba == NULL ||
                        frontend->pool_hba->auth_method == uaPassword ||
-                       pool_config->allow_clear_text_frontend_auth )
+                       pool_config->allow_clear_text_frontend_auth)
                {
                        ereport(DEBUG1,
-                               (errmsg("using clear text authentication with frontend"),
+                                       (errmsg("using clear text authentication with frontend"),
                                         errdetail("backend is using password authentication")));
 
                        authenticate_frontend_clear_text(frontend);
@@ -1086,8 +1084,8 @@ do_clear_text_password(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, in
                        {
                                ereport(FATAL,
                                                (return_code(2),
-                                                       errmsg("clear text password authentication failed"),
-                                                       errdetail("unable to get the password for user: \"%s\"", frontend->username)));
+                                                errmsg("clear text password authentication failed"),
+                                                errdetail("unable to get the password for user: \"%s\"", frontend->username)));
                        }
                }
        }
@@ -1157,7 +1155,7 @@ do_clear_text_password(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, in
  * password in the pool_passwd file.
  */
 static void
-authenticate_frontend_SCRAM(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth)
+authenticate_frontend_SCRAM(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reauth)
 {
        void       *scram_opaq;
        char       *output = NULL;
@@ -1172,7 +1170,7 @@ authenticate_frontend_SCRAM(POOL_CONNECTION * backend, POOL_CONNECTION * fronten
        PasswordType storedPasswordType = PASSWORD_TYPE_UNKNOWN;
        char       *storedPassword = NULL;
 
-       if (get_auth_password(backend, frontend, reauth,&storedPassword, &storedPasswordType) == false)
+       if (get_auth_password(backend, frontend, reauth, &storedPassword, &storedPasswordType) == false)
        {
                ereport(FATAL,
                                (return_code(2),
@@ -1341,7 +1339,7 @@ authenticate_frontend_SCRAM(POOL_CONNECTION * backend, POOL_CONNECTION * fronten
  * Authenticate frontend using pool_hba.conf
  */
 void
-authenticate_frontend(POOL_CONNECTION * frontend)
+authenticate_frontend(POOL_CONNECTION *frontend)
 {
        switch (frontend->pool_hba->auth_method)
        {
@@ -1379,7 +1377,7 @@ authenticate_frontend(POOL_CONNECTION * frontend)
 
 #ifdef USE_SSL
 static void
-authenticate_frontend_cert(POOL_CONNECTION * frontend)
+authenticate_frontend_cert(POOL_CONNECTION *frontend)
 {
        if (frontend->client_cert_loaded == true && frontend->cert_cn)
        {
@@ -1406,7 +1404,7 @@ authenticate_frontend_cert(POOL_CONNECTION * frontend)
 }
 #else
 static void
-authenticate_frontend_cert(POOL_CONNECTION * frontend)
+authenticate_frontend_cert(POOL_CONNECTION *frontend)
 {
        ereport(ERROR,
                        (errmsg("CERT authentication failed"),
@@ -1415,7 +1413,7 @@ authenticate_frontend_cert(POOL_CONNECTION * frontend)
 #endif
 
 static void
-authenticate_frontend_md5(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth, int protoMajor)
+authenticate_frontend_md5(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reauth, int protoMajor)
 {
        char            salt[4];
        static int      size;
@@ -1427,7 +1425,7 @@ authenticate_frontend_md5(POOL_CONNECTION * backend, POOL_CONNECTION * frontend,
        PasswordType storedPasswordType = PASSWORD_TYPE_UNKNOWN;
        char       *storedPassword = NULL;
 
-       if (get_auth_password(backend, frontend, reauth,&storedPassword, &storedPasswordType) == false)
+       if (get_auth_password(backend, frontend, reauth, &storedPassword, &storedPasswordType) == false)
        {
                ereport(FATAL,
                                (return_code(2),
@@ -1503,7 +1501,7 @@ authenticate_frontend_md5(POOL_CONNECTION * backend, POOL_CONNECTION * frontend,
  * it.
  */
 static bool
-get_auth_password(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth,
+get_auth_password(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reauth,
                                  char **password, PasswordType *passwordType)
 {
        /* First preference is to use the pool_passwd file */
@@ -1552,7 +1550,7 @@ get_auth_password(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int rea
  * perform MD5 authentication
  */
 static int
-do_md5(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth, int protoMajor,
+do_md5(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reauth, int protoMajor,
           char *storedPassword, PasswordType passwordType)
 {
        char            salt[4];
@@ -1669,7 +1667,7 @@ do_md5(POOL_CONNECTION * backend, POOL_CONNECTION * frontend, int reauth, int pr
  * Send an authentication request packet to the frontend.
  */
 static void
-sendAuthRequest(POOL_CONNECTION * frontend, int protoMajor, int32 auth_req_type, char *extradata, int extralen)
+sendAuthRequest(POOL_CONNECTION *frontend, int protoMajor, int32 auth_req_type, char *extradata, int extralen)
 {
        int                     kind = htonl(auth_req_type);
 
@@ -1692,7 +1690,7 @@ sendAuthRequest(POOL_CONNECTION * frontend, int protoMajor, int32 auth_req_type,
  * Send md5 authentication request packet to frontend
  */
 static void
-send_md5auth_request(POOL_CONNECTION * frontend, int protoMajor, char *salt)
+send_md5auth_request(POOL_CONNECTION *frontend, int protoMajor, char *salt)
 {
        sendAuthRequest(frontend, protoMajor, AUTH_REQ_MD5, salt, 4);
 }
@@ -1702,7 +1700,7 @@ send_md5auth_request(POOL_CONNECTION * frontend, int protoMajor, char *salt)
  * Read password packet from frontend
  */
 static int
-read_password_packet(POOL_CONNECTION * frontend, int protoMajor, char *password, int *pwdSize)
+read_password_packet(POOL_CONNECTION *frontend, int protoMajor, char *password, int *pwdSize)
 {
        int                     size;
 
@@ -1755,7 +1753,7 @@ read_password_packet(POOL_CONNECTION * frontend, int protoMajor, char *password,
  * "password" must be null-terminated.
  */
 static int
-send_password_packet(POOL_CONNECTION * backend, int protoMajor, char *password)
+send_password_packet(POOL_CONNECTION *backend, int protoMajor, char *password)
 {
        int                     size;
        int                     len;
@@ -1811,7 +1809,7 @@ send_password_packet(POOL_CONNECTION * backend, int protoMajor, char *password)
  * Send auth ok to frontend
  */
 static int
-send_auth_ok(POOL_CONNECTION * frontend, int protoMajor)
+send_auth_ok(POOL_CONNECTION *frontend, int protoMajor)
 {
        int                     msglen;
 
@@ -1850,7 +1848,7 @@ pool_random_salt(char *md5Salt)
 }
 
 static bool
-do_SCRAM(POOL_CONNECTION * frontend, POOL_CONNECTION * backend, int protoMajor, int message_length,
+do_SCRAM(POOL_CONNECTION *frontend, POOL_CONNECTION *backend, int protoMajor, int message_length,
                 char *username, char *storedPassword, PasswordType passwordType)
 {
        /* read the packet first */
@@ -1979,7 +1977,7 @@ do_SCRAM(POOL_CONNECTION * frontend, POOL_CONNECTION * backend, int protoMajor,
 }
 
 static void *
-pg_SASL_init(POOL_CONNECTION * backend, char *payload, int payloadlen, char *username, char *storedPassword)
+pg_SASL_init(POOL_CONNECTION *backend, char *payload, int payloadlen, char *username, char *storedPassword)
 {
        char       *initialresponse = NULL;
        int                     initialresponselen;
@@ -2082,7 +2080,7 @@ pg_SASL_init(POOL_CONNECTION * backend, char *payload, int payloadlen, char *use
  * the protocol.
  */
 static int
-pg_SASL_continue(POOL_CONNECTION * backend, char *payload, int payloadlen, void *sasl_state, bool final)
+pg_SASL_continue(POOL_CONNECTION *backend, char *payload, int payloadlen, void *sasl_state, bool final)
 {
        char       *output;
        int                     outputlen;
@@ -2141,21 +2139,21 @@ pg_SASL_continue(POOL_CONNECTION * backend, char *payload, int payloadlen, void
 static void
 ProcessNegotiateProtocol(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
 {
-       int32   len;
-       int32   savelen;
-       int32   protoMajor;
-       int32   protoMinor;
-       int32   protov;
-       bool    forwardMsg = false;
-       int             i;
+       int32           len;
+       int32           savelen;
+       int32           protoMajor;
+       int32           protoMinor;
+       int32           protov;
+       bool            forwardMsg = false;
+       int                     i;
 
        elog(DEBUG1, "Forwarding NegotiateProtocol message to frontend");
        pool_write(frontend, "v", 1);   /* forward message kind */
-       savelen = len = pool_read_int(cp);              /* message length including self */
+       savelen = len = pool_read_int(cp);      /* message length including self */
        pool_write(frontend, &len, 4);  /* forward message length */
-       len = ntohl(len) - 4;                   /* length of rest of the message */
-       protov = pool_read_int(cp);     /* read protocol version */
-       protoMajor = PG_PROTOCOL_MAJOR(ntohl(protov));          /* protocol major version */
+       len = ntohl(len) - 4;           /* length of rest of the message */
+       protov = pool_read_int(cp); /* read protocol version */
+       protoMajor = PG_PROTOCOL_MAJOR(ntohl(protov));  /* protocol major version */
        protoMinor = PG_PROTOCOL_MINOR(ntohl(protov));  /* protocol minor version */
        pool_write(frontend, &protov, 4);       /* forward protocol version */
        elog(DEBUG1, "protocol verion offered: major: %d minor: %d", protoMajor, protoMinor);
@@ -2164,15 +2162,16 @@ ProcessNegotiateProtocol(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
        {
                if (VALID_BACKEND(i))
                {
-                       POOL_CONNECTION_POOL_SLOT       *sp;
-                       char    *p;
-                       char    *np;
-                       Size    nplen;
+                       POOL_CONNECTION_POOL_SLOT *sp;
+                       char       *p;
+                       char       *np;
+                       Size            nplen;
 
                        p = pool_read2(CONNECTION(cp, i), len);
                        if (!forwardMsg)
                        {
-                               pool_write_and_flush(frontend, p, len); /* forward rest of message */
+                               pool_write_and_flush(frontend, p, len); /* forward rest of
+                                                                                                                * message */
                                forwardMsg = true;
                        }
                        /* save negatiate protocol version */
@@ -2181,10 +2180,10 @@ ProcessNegotiateProtocol(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
                        sp->negotiated_minor = protoMinor;
 
                        /* save negatiate protocol message */
-                       nplen = 1 +     /* message kind */
+                       nplen = 1 +                     /* message kind */
                                sizeof(savelen) +       /* message length */
                                sizeof(protov) +        /* protocol version */
-                               len;                            /* rest of message */
+                               len;                    /* rest of message */
                        /* allocate message area */
                        sp->negotiateProtocolMsg = MemoryContextAlloc(TopMemoryContext, nplen);
                        np = sp->negotiateProtocolMsg;
index 202195b430b3efc534f096b458f734c17d0f36e8..8daf74a97cf621c264133ce4e389b4f7ff2ca4c1 100644 (file)
@@ -109,37 +109,37 @@ static HbaToken *copy_hba_token(HbaToken *in);
 static HbaToken *make_hba_token(const char *token, bool quoted);
 
 static bool parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline,
-                                  int elevel, char **err_msg);
+                                                          int elevel, char **err_msg);
 
 static MemoryContext tokenize_file(const char *filename, FILE *file,
-                         List **tok_lines, int elevel);
-static void sendAuthRequest(POOL_CONNECTION * frontend, AuthRequest areq);
-static void auth_failed(POOL_CONNECTION * frontend);
-static bool hba_getauthmethod(POOL_CONNECTION * frontend);
-static bool check_hba(POOL_CONNECTION * frontend);
+                                                                  List **tok_lines, int elevel);
+static void sendAuthRequest(POOL_CONNECTION *frontend, AuthRequest areq);
+static void auth_failed(POOL_CONNECTION *frontend);
+static bool hba_getauthmethod(POOL_CONNECTION *frontend);
+static bool check_hba(POOL_CONNECTION *frontend);
 static bool check_user(char *user, List *tokens);
 static bool check_db(const char *dbname, const char *user, List *tokens);
 static List *tokenize_inc_file(List *tokens,
-                                 const char *outer_filename,
-                                 const char *inc_filename,
-                                 int elevel,
-                                 char **err_msg);
+                                                          const char *outer_filename,
+                                                          const char *inc_filename,
+                                                          int elevel,
+                                                          char **err_msg);
 static bool
-                       check_hostname(POOL_CONNECTION * frontend, const char *hostname);
+                       check_hostname(POOL_CONNECTION *frontend, const char *hostname);
 static bool
                        check_ip(SockAddr *raddr, struct sockaddr *addr, struct sockaddr *mask);
 static bool
                        check_same_host_or_net(SockAddr *raddr, IPCompareMethod method);
 static void check_network_callback(struct sockaddr *addr, struct sockaddr *netmask,
-                                          void *cb_data);
+                                                                  void *cb_data);
 
 static HbaLine *parse_hba_line(TokenizedLine *tok_line, int elevel);
 static bool pg_isblank(const char c);
 static bool next_token(char **lineptr, char *buf, int bufsz,
-                  bool *initial_quote, bool *terminating_comma,
-                  int elevel, char **err_msg);
+                                          bool *initial_quote, bool *terminating_comma,
+                                          int elevel, char **err_msg);
 static List *next_field_expand(const char *filename, char **lineptr,
-                                 int elevel, char **err_msg);
+                                                          int elevel, char **err_msg);
 #ifdef NOT_USED
 static POOL_STATUS CheckUserExist(char *username);
 #endif
@@ -154,7 +154,7 @@ static POOL_STATUS CheckUserExist(char *username);
 
 #define PGPOOL_PAM_SERVICE "pgpool" /* Service name passed to PAM */
 
-static POOL_STATUS CheckPAMAuth(POOL_CONNECTION * frontend, char *user, char *password);
+static POOL_STATUS CheckPAMAuth(POOL_CONNECTION *frontend, char *user, char *password);
 static int     pam_passwd_conv_proc(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr);
 
 static struct pam_conv pam_passwd_conv = {
@@ -163,7 +163,7 @@ static struct pam_conv pam_passwd_conv = {
 };
 
 static char *pam_passwd = NULL; /* Workaround for Solaris 2.6 brokenness */
-static POOL_CONNECTION * pam_frontend_kludge;  /* Workaround for passing
+static POOL_CONNECTION *pam_frontend_kludge;   /* Workaround for passing
                                                                                                 * POOL_CONNECTION *frontend
                                                                                                 * into pam_passwd_conv_proc */
 #endif                                                 /* USE_PAM */
@@ -189,7 +189,7 @@ static POOL_STATUS CheckLDAPAuth(POOL_CONNECTION *frontend);
  * so declare a prototype here in "#if defined(USE_PAM or USE_LDAP)" to avoid
  * compilation warning.
  */
-static char *recv_password_packet(POOL_CONNECTION * frontend);
+static char *recv_password_packet(POOL_CONNECTION *frontend);
 #endif                                                 /* USE_PAM or USE_LDAP */
 
 /*
@@ -761,6 +761,7 @@ parse_hba_line(TokenizedLine *tok_line, int elevel)
        }
 
 #ifdef USE_LDAP
+
        /*
         * Check if the selected authentication method has any mandatory arguments
         * that are not set.
@@ -1166,7 +1167,7 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline,
  * do frontend <-> pgpool authentication based on pool_hba.conf
  */
 void
-ClientAuthentication(POOL_CONNECTION * frontend)
+ClientAuthentication(POOL_CONNECTION *frontend)
 {
        POOL_STATUS status = POOL_END;
        MemoryContext oldContext;
@@ -1182,10 +1183,9 @@ ClientAuthentication(POOL_CONNECTION * frontend)
 
                /*
                 * Get the password for the user if it is stored in the pool_password
-                * file
-                * authentication process is called in the temporary memory
-                * context, but password mappings has to live till the life time
-                * of frontend connection, so call the pool_get_user_credentials in
+                * file authentication process is called in the temporary memory
+                * context, but password mappings has to live till the life time of
+                * frontend connection, so call the pool_get_user_credentials in
                 * ProcessLoopContext memory context
                 */
                oldContext = MemoryContextSwitchTo(ProcessLoopContext);
@@ -1215,7 +1215,7 @@ ClientAuthentication(POOL_CONNECTION * frontend)
 
 #ifdef USE_SSL
                                        ereport(FATAL,
-                                               (return_code(2),
+                                                       (return_code(2),
                                                         errmsg("client authentication failed"),
                                                         errdetail("no pool_hba.conf entry for host \"%s\", user \"%s\", database \"%s\", %s",
                                                                           hostinfo, frontend->username, frontend->database,
@@ -1323,7 +1323,7 @@ ClientAuthentication(POOL_CONNECTION * frontend)
 
 
 static void
-sendAuthRequest(POOL_CONNECTION * frontend, AuthRequest areq)
+sendAuthRequest(POOL_CONNECTION *frontend, AuthRequest areq)
 {
        int                     wsize;                  /* number of bytes to write */
        int                     areq_nbo;               /* areq in network byte order */
@@ -1371,7 +1371,7 @@ sendAuthRequest(POOL_CONNECTION * frontend, AuthRequest areq)
  * Returns NULL if couldn't get password, else palloc'd string.
  */
 static char *
-recv_password_packet(POOL_CONNECTION * frontend)
+recv_password_packet(POOL_CONNECTION *frontend)
 {
        int                     rsize;
        char       *passwd;
@@ -1421,7 +1421,7 @@ recv_password_packet(POOL_CONNECTION * frontend)
  * Tell the user the authentication failed.
  */
 static void
-auth_failed(POOL_CONNECTION * frontend)
+auth_failed(POOL_CONNECTION *frontend)
 {
        int                     messagelen;
        char       *errmessage;
@@ -1521,7 +1521,7 @@ auth_failed(POOL_CONNECTION * frontend)
  *  we return true and method = uaReject.
  */
 static bool
-hba_getauthmethod(POOL_CONNECTION * frontend)
+hba_getauthmethod(POOL_CONNECTION *frontend)
 {
        if (check_hba(frontend))
                return true;
@@ -1535,7 +1535,7 @@ hba_getauthmethod(POOL_CONNECTION * frontend)
 *      request.
 */
 static bool
-check_hba(POOL_CONNECTION * frontend)
+check_hba(POOL_CONNECTION *frontend)
 {
        ListCell   *line;
        HbaLine    *hba;
@@ -1672,7 +1672,7 @@ hostname_match(const char *pattern, const char *actual_hostname)
  * Check to see if a connecting IP matches a given host name.
  */
 static bool
-check_hostname(POOL_CONNECTION * frontend, const char *hostname)
+check_hostname(POOL_CONNECTION *frontend, const char *hostname)
 {
        struct addrinfo *gai_result,
                           *gai;
@@ -2363,7 +2363,8 @@ pam_passwd_conv_proc(int num_msg, const struct pam_message **msg,
 /*
  * Check authentication against PAM.
  */
-static POOL_STATUS CheckPAMAuth(POOL_CONNECTION * frontend, char *user, char *password)
+static POOL_STATUS
+CheckPAMAuth(POOL_CONNECTION *frontend, char *user, char *password)
 {
        int                     retval;
        pam_handle_t *pamh = NULL;
@@ -2379,8 +2380,8 @@ static POOL_STATUS CheckPAMAuth(POOL_CONNECTION * frontend, char *user, char *pa
         * later used inside the PAM conversation to pass the password to the
         * authentication module.
         */
-       pam_passwd_conv.appdata_ptr = (char *) password; /* from password above,
-                                                                                                        * not allocated */
+       pam_passwd_conv.appdata_ptr = (char *) password;        /* from password above,
+                                                                                                                * not allocated */
 
        /* Optionally, one can set the service name in pool_hba.conf */
        if (frontend->pool_hba->pamservice && frontend->pool_hba->pamservice[0] != '\0')
@@ -2673,7 +2674,8 @@ FormatSearchFilter(const char *pattern, const char *user_name)
 /*
  * Check authentication against LDAP.
  */
-static POOL_STATUS CheckLDAPAuth(POOL_CONNECTION * frontend)
+static POOL_STATUS
+CheckLDAPAuth(POOL_CONNECTION *frontend)
 {
        char       *passwd;
        LDAP       *ldap;
@@ -2722,7 +2724,7 @@ static POOL_STATUS CheckLDAPAuth(POOL_CONNECTION * frontend)
 
        passwd = recv_password_packet(frontend);
        if (passwd == NULL)
-               return -2;              /* client wouldn't send password */
+               return -2;                              /* client wouldn't send password */
 
        if (InitializeLDAPConnection(frontend, &ldap) == -1)
        {
@@ -2925,7 +2927,8 @@ static POOL_STATUS CheckLDAPAuth(POOL_CONNECTION * frontend)
 #endif                                                 /* USE_LDAP */
 
 #ifdef NOT_USED
-static POOL_STATUS CheckUserExist(char *username)
+static POOL_STATUS
+CheckUserExist(char *username)
 {
        char       *passwd;
 
index 41bd38f07872fcc15a5e477085984030b620702f..91b0efd00e1164ac8a9c5f7c1f86841889b42ad9 100644 (file)
@@ -58,7 +58,8 @@ pool_init_pool_passwd(char *pool_passwd_filename, POOL_PASSWD_MODE mode)
 
        if (pool_passwd_filename == NULL)
        {
-               saved_passwd_filename[0] = '\0'; /* indicate pool_passwd is disabled */
+               saved_passwd_filename[0] = '\0';        /* indicate pool_passwd is
+                                                                                        * disabled */
                return;
        }
 
@@ -102,10 +103,10 @@ pool_create_passwdent(char *username, char *passwd)
 {
 #define LINE_LEN \
                MAX_USER_NAME_LEN + 1 + MAX_POOL_PASSWD_LEN + 2
-       char    linebuf[LINE_LEN];
-       char    *writebuf = NULL;
-       int             len;
-       bool    updated = false;
+       char            linebuf[LINE_LEN];
+       char       *writebuf = NULL;
+       int                     len;
+       bool            updated = false;
 
        if (!passwd_fd)
                ereport(ERROR,
@@ -124,8 +125,8 @@ pool_create_passwdent(char *username, char *passwd)
 
        while (!feof(passwd_fd) && !ferror(passwd_fd))
        {
-               char       *t = linebuf;
-               int         len;
+               char       *t = linebuf;
+               int                     len;
 
                if (fgets(linebuf, sizeof(linebuf), passwd_fd) == NULL)
                        break;
@@ -162,7 +163,7 @@ pool_create_passwdent(char *username, char *passwd)
                strcat(writebuf, linebuf);
        }
 
-       if(!writebuf)
+       if (!writebuf)
                return 0;
 
        fclose(passwd_fd);
@@ -203,7 +204,7 @@ pool_get_passwd(char *username)
        {
                if (strlen(saved_passwd_filename))
                        ereport(ERROR,
-                               (errmsg("unable to get password, password file descriptor is NULL")));
+                                       (errmsg("unable to get password, password file descriptor is NULL")));
                else
                        return NULL;
        }
@@ -355,7 +356,7 @@ pool_get_user_credentials(char *username)
        {
                if (strlen(saved_passwd_filename))
                        ereport(WARNING,
-                               (errmsg("unable to get password, password file descriptor is NULL")));
+                                       (errmsg("unable to get password, password file descriptor is NULL")));
                return NULL;
        }
 
@@ -416,7 +417,7 @@ pool_get_user_credentials(char *username)
 }
 
 void
-delete_passwordMapping(PasswordMapping * pwdMapping)
+delete_passwordMapping(PasswordMapping *pwdMapping)
 {
        if (!pwdMapping)
                return;
@@ -476,8 +477,8 @@ get_pgpool_config_user_password(char *username, char *password_in_config)
        PasswordMapping *password_mapping = NULL;
 
        /*
-        * if the password specified in config is empty string or NULL look for the
-        * password in pool_passwd file
+        * if the password specified in config is empty string or NULL look for
+        * the password in pool_passwd file
         */
        if (password_in_config == NULL || strlen(password_in_config) == 0)
        {
@@ -525,7 +526,7 @@ get_pgpool_config_user_password(char *username, char *password_in_config)
                /* convert the TEXT prefixed password to plain text password */
                passwordType = PASSWORD_TYPE_PLAINTEXT;
                if (password)
-                       password = (char*)(password + strlen(PASSWORD_TEXT_PREFIX));
+                       password = (char *) (password + strlen(PASSWORD_TEXT_PREFIX));
        }
 
        if (password && strlen(password) && (passwordType != PASSWORD_TYPE_PLAINTEXT &&
@@ -634,11 +635,11 @@ read_pool_key(char *key_file_path)
                return NULL;
 
        /*
-        * To prevent file-swapping due to file race conditions,
-        * we open the key file before checking it by stat().
+        * To prevent file-swapping due to file race conditions, we open the key
+        * file before checking it by stat().
         */
        /* If password file cannot be opened, ignore it. */
-       if ( (fp = fopen(key_file_path, "r")) == NULL)
+       if ((fp = fopen(key_file_path, "r")) == NULL)
                return NULL;
 
        if (fstat(fileno(fp), &stat_buf) != 0)
@@ -707,12 +708,13 @@ check_password_type_is_not_md5(char *username, char *password_in_config)
        PasswordType passwordType = PASSWORD_TYPE_UNKNOWN;
 
        /*
-        * if the password specified in config is empty string or NULL look for the
-        * password in pool_passwd file
+        * if the password specified in config is empty string or NULL look for
+        * the password in pool_passwd file
         */
        if (password_in_config == NULL || strlen(password_in_config) == 0)
        {
                PasswordMapping *password_mapping = NULL;
+
                password_mapping = pool_get_user_credentials(username);
                if (password_mapping == NULL)
                {
@@ -726,7 +728,7 @@ check_password_type_is_not_md5(char *username, char *password_in_config)
                passwordType = get_password_type(password_in_config);
        }
 
-       /* if the password type is MD5 hash return -1*/
+       /* if the password type is MD5 hash return -1 */
        if (passwordType == PASSWORD_TYPE_MD5)
        {
                return -1;
index 83ce0c2bf38ad8d40ed3a8baf7b16098bc244e55..31f42caa9e22bd67909435f2988f835fe4e44995 100644 (file)
@@ -85,22 +85,22 @@ static bool config_post_processor(ConfigContext context, int elevel);
 
 static void sort_config_vars(void);
 static bool setConfigOptionArrayVarWithConfigDefault(struct config_generic *record, const char *name,
-                                                                                const char *value, ConfigContext context, int elevel);
+                                                                                                        const char *value, ConfigContext context, int elevel);
 
 static bool setConfigOption(const char *name, const char *value,
-                               ConfigContext context, GucSource source, int elevel);
+                                                       ConfigContext context, GucSource source, int elevel);
 static bool setConfigOptionVar(struct config_generic *record, const char *name, int index_val,
-                                  const char *value, ConfigContext context, GucSource source, int elevel);
+                                                          const char *value, ConfigContext context, GucSource source, int elevel);
 
 static bool get_index_in_var_name(struct config_generic *record,
-                                         const char *name, int *index, int elevel);
+                                                                 const char *name, int *index, int elevel);
 
 
 static bool MakeUserRedirectListRegex(char *newval, int elevel);
 static bool MakeDBRedirectListRegex(char *newval, int elevel);
 static bool MakeAppRedirectListRegex(char *newval, int elevel);
 static bool MakeDMLAdaptiveObjectRelationList(char *newval, int elevel);
-static chargetParsedToken(char *token, DBObjectTypes *object_type);
+static char *getParsedToken(char *token, DBObjectTypes *object_type);
 
 static bool check_redirect_node_spec(char *node_spec);
 static char **get_list_from_string(const char *str, const char *delimi, int *n);
@@ -180,7 +180,7 @@ static bool convert_to_base_unit(double value, const char *unit,
 #ifndef POOL_PRIVATE
 
 static void convert_int_from_base_unit(int64 base_value, int base_unit,
-                                                  int64 *value, const char **unit);
+                                                                          int64 *value, const char **unit);
 
 
 /* These functions are used to provide Hints for enum type config parameters and
@@ -194,12 +194,12 @@ static const char *config_enum_lookup_by_value(struct config_enum *record, int v
 static char *ShowOption(struct config_generic *record, int index, int elevel);
 
 static char *config_enum_get_options(struct config_enum *record, const char *prefix,
-                                               const char *suffix, const char *separator);
-static void send_row_description_for_detail_view(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend);
-static int send_grouped_type_variable_to_frontend(struct config_grouped_array_var *grouped_record,
-                                                                          POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend);
-static int send_array_type_variable_to_frontend(struct config_generic *record,
-                                                                        POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend);
+                                                                        const char *suffix, const char *separator);
+static void send_row_description_for_detail_view(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
+static int     send_grouped_type_variable_to_frontend(struct config_grouped_array_var *grouped_record,
+                                                                                                  POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
+static int     send_array_type_variable_to_frontend(struct config_generic *record,
+                                                                                                POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
 
 #endif
 
@@ -300,17 +300,20 @@ static const struct config_enum_entry relcache_query_target_options[] = {
 };
 
 static const struct config_enum_entry check_temp_table_options[] = {
-       {"catalog", CHECK_TEMP_CATALOG, false}, /* search system catalogs */
-       {"trace", CHECK_TEMP_TRACE, false},             /* tracing temp tables */
-       {"none", CHECK_TEMP_NONE, false},               /* do not check temp tables */
-       {"on", CHECK_TEMP_ON, false},                   /* same as CHECK_TEMP_CATALOG. Just for backward compatibility. */
-       {"off", CHECK_TEMP_OFF, false},                 /* same as CHECK_TEMP_NONE. Just for backward compatibility. */
+       {"catalog", CHECK_TEMP_CATALOG, false}, /* search system catalogs */
+       {"trace", CHECK_TEMP_TRACE, false}, /* tracing temp tables */
+       {"none", CHECK_TEMP_NONE, false},       /* do not check temp tables */
+       {"on", CHECK_TEMP_ON, false},   /* same as CHECK_TEMP_CATALOG. Just for
+                                                                        * backward compatibility. */
+       {"off", CHECK_TEMP_OFF, false}, /* same as CHECK_TEMP_NONE. Just for
+                                                                        * backward compatibility. */
        {NULL, 0, false}
 };
 
 static const struct config_enum_entry log_backend_messages_options[] = {
-       {"none", BGMSG_NONE, false},            /* turn off logging */
-       {"terse", BGMSG_TERSE, false},          /* terse logging (repeated messages are collapsed into count */
+       {"none", BGMSG_NONE, false},    /* turn off logging */
+       {"terse", BGMSG_TERSE, false},  /* terse logging (repeated messages are
+                                                                        * collapsed into count */
        {"verbose", BGMSG_VERBOSE, false},      /* always log each message */
        {NULL, 0, false}
 };
@@ -810,8 +813,8 @@ static struct config_bool ConfigureNamesBool[] =
 
        {
                {"health_check_test", CFGCXT_INIT, HEALTH_CHECK_CONFIG,
-                "If on, enable health check testing.",
-                CONFIG_VAR_TYPE_BOOL, false, 0
+                       "If on, enable health check testing.",
+                       CONFIG_VAR_TYPE_BOOL, false, 0
                },
                &g_pool_config.health_check_test,
                false,
@@ -1825,7 +1828,7 @@ static struct config_string_array ConfigureNamesStringArray[] =
                        CONFIG_VAR_TYPE_STRING_ARRAY, true, VAR_PART_OF_GROUP, MAX_NUM_BACKENDS
                },
                NULL,
-               "",     /* for ALWAYS_PRIMARY */
+               "",                                             /* for ALWAYS_PRIMARY */
                EMPTY_CONFIG_STRING,
                BackendFlagsAssignFunc, NULL, BackendFlagsShowFunc, BackendSlotEmptyCheckFunc
        },
@@ -2285,7 +2288,7 @@ static struct config_int ConfigureNamesInt[] =
                        CONFIG_VAR_TYPE_INT, false, GUC_UNIT_MIN
                },
                &g_pool_config.log_rotation_age,
-               1440,/*1 day*/
+               1440,                                   /* 1 day */
                0, INT_MAX,
                NULL, NULL, NULL
        },
@@ -2296,7 +2299,7 @@ static struct config_int ConfigureNamesInt[] =
                },
                &g_pool_config.log_rotation_size,
                10 * 1024,
-               0, INT_MAX/1024,
+               0, INT_MAX / 1024,
                NULL, NULL, NULL
        },
        {
@@ -3106,7 +3109,7 @@ get_list_from_string(const char *str, const char *delimi, int *n)
 
        for (token = strtok(temp_string, delimi); token != NULL; token = strtok(NULL, delimi))
        {
-               int i;
+               int                     i;
 
                /* skip leading whitespace */
                while (isspace(*token))
@@ -3114,7 +3117,8 @@ get_list_from_string(const char *str, const char *delimi, int *n)
 
                /* skip trailing whitespace */
                i = strlen(token) - 1;
-               while (i >= 0 && isspace(token[i])) {
+               while (i >= 0 && isspace(token[i]))
+               {
                        token[i] = '\0';
                        i--;
                }
@@ -3186,7 +3190,8 @@ get_list_from_string_regex_delim(const char *input, const char *delimi, int *n)
                }
                else if (*str_temp == *delimi)
                {
-                       char *output = (char *) palloc(j + 1);
+                       char       *output = (char *) palloc(j + 1);
+
                        StrNCpy(output, buf, j + 1);
 
                        /* replace escape character of "'" */
@@ -3642,7 +3647,7 @@ setConfigOptionVar(struct config_generic *record, const char *name, int index_va
 
                                if (value != NULL)
                                {
-                                       int64 newval64;
+                                       int64           newval64;
                                        const char *hintmsg;
 
                                        if (!parse_int(value, &newval64,
@@ -3654,7 +3659,7 @@ setConfigOptionVar(struct config_generic *record, const char *name, int index_va
                                                                 hintmsg ? errhint("%s", _(hintmsg)) : 0));
                                                return false;
                                        }
-                                       newval = (int)newval64;
+                                       newval = (int) newval64;
                                }
                                else if (source == PGC_S_DEFAULT)
                                {
@@ -3752,7 +3757,7 @@ setConfigOptionVar(struct config_generic *record, const char *name, int index_va
 
                                if (value != NULL)
                                {
-                                       int64 newval64;
+                                       int64           newval64;
                                        const char *hintmsg;
 
                                        if (!parse_int(value, &newval64,
@@ -3764,7 +3769,7 @@ setConfigOptionVar(struct config_generic *record, const char *name, int index_va
                                                                 hintmsg ? errhint("%s", _(hintmsg)) : 0));
                                                return false;
                                        }
-                                       newval = (int)newval64;
+                                       newval = (int) newval64;
                                }
                                else if (source == PGC_S_DEFAULT)
                                {
@@ -4551,7 +4556,7 @@ BackendFlagsShowFunc(int index)
                if (*buffer == '\0')
                        snprintf(buffer, sizeof(buffer), "ALWAYS_PRIMARY");
                else
-                       snprintf(buffer+strlen(buffer), sizeof(buffer), "|ALWAYS_PRIMARY");
+                       snprintf(buffer + strlen(buffer), sizeof(buffer), "|ALWAYS_PRIMARY");
        }
        return buffer;
 }
@@ -4577,7 +4582,7 @@ WdSlotEmptyCheckFunc(int index)
 static bool
 WdIFSlotEmptyCheckFunc(int index)
 {
-       return (g_pool_config.hb_ifs[index].dest_port  == 0);
+       return (g_pool_config.hb_ifs[index].dest_port == 0);
 }
 
 static const char *
@@ -4809,6 +4814,7 @@ FailOverOnBackendErrorAssignMessage(ConfigContext scontext, bool newval, int ele
        g_pool_config.failover_on_backend_error = newval;
        return true;
 }
+
 /*
  * Throws warning for if someone uses the removed delegate_IP
  * configuration parameter and set the value to delegate_ip
@@ -4823,6 +4829,7 @@ DelegateIPAssignMessage(ConfigContext scontext, char *newval, int elevel)
        g_pool_config.delegate_ip = newval;
        return true;
 }
+
 /*
  * Check DB node spec. node spec should be either "primary", "standby" or
  * numeric DB node id.
@@ -4864,9 +4871,9 @@ check_redirect_node_spec(char *node_spec)
 static bool
 config_post_processor(ConfigContext context, int elevel)
 {
-       double           total_weight = 0.0;
+       double          total_weight = 0.0;
        sig_atomic_t local_num_backends = 0;
-       int                      i;
+       int                     i;
 
        /* read from pgpool_node_id */
        SetPgpoolNodeId(elevel);
@@ -4987,9 +4994,9 @@ config_post_processor(ConfigContext context, int elevel)
 
        /*
         * Quarantine state in native replication mode is dangerous and it can
-        * potentially cause data inconsistency.
-        * So as per the discussions, we agreed on disallowing setting
-        * failover_when_quorum_exists in native replication mode
+        * potentially cause data inconsistency. So as per the discussions, we
+        * agreed on disallowing setting failover_when_quorum_exists in native
+        * replication mode
         */
 
        if (pool_config->failover_when_quorum_exists && pool_config->replication_mode)
@@ -5001,8 +5008,8 @@ config_post_processor(ConfigContext context, int elevel)
        }
 
        /*
-        * Verify the minimum and maximum number of spare children configuration when
-        * dynamic process management is enabled
+        * Verify the minimum and maximum number of spare children configuration
+        * when dynamic process management is enabled
         */
 
        if (g_pool_config.process_management == PM_DYNAMIC)
@@ -5011,14 +5018,14 @@ config_post_processor(ConfigContext context, int elevel)
                {
                        ereport(elevel,
                                        (errmsg("invalid configuration, max_spare_children:%d must be greater than min_spare_children:%d",
-                                       pool_config->max_spare_children,pool_config->min_spare_children)));
+                                                       pool_config->max_spare_children, pool_config->min_spare_children)));
                        return false;
                }
                if (pool_config->num_init_children < pool_config->max_spare_children)
                {
                        ereport(elevel,
                                        (errmsg("invalid configuration, max_spare_children:%d can't be greater than num_init_children:%d",
-                                       pool_config->max_spare_children,pool_config->num_init_children)));
+                                                       pool_config->max_spare_children, pool_config->num_init_children)));
                        return false;
                }
        }
@@ -5028,9 +5035,9 @@ config_post_processor(ConfigContext context, int elevel)
 static bool
 MakeDMLAdaptiveObjectRelationList(char *newval, int elevel)
 {
-       int i;
-       int elements_count = 0;
-       char **rawList = get_list_from_string(newval, ",", &elements_count);
+       int                     i;
+       int                     elements_count = 0;
+       char      **rawList = get_list_from_string(newval, ",", &elements_count);
 
        if (rawList == NULL || elements_count == 0)
        {
@@ -5041,21 +5048,21 @@ MakeDMLAdaptiveObjectRelationList(char *newval, int elevel)
 
        for (i = 0; i < elements_count; i++)
        {
-               char *kvstr = rawList[i];
-               char *left_token = strtok(kvstr, ":");
-               char *right_token = strtok(NULL, ":");
+               char       *kvstr = rawList[i];
+               char       *left_token = strtok(kvstr, ":");
+               char       *right_token = strtok(NULL, ":");
                DBObjectTypes object_type;
 
                ereport(DEBUG5,
                                (errmsg("dml_adaptive_init"),
-                                       errdetail("%s -- left_token[%s] right_token[%s]", kvstr, left_token, right_token)));
+                                errdetail("%s -- left_token[%s] right_token[%s]", kvstr, left_token, right_token)));
 
                pool_config->parsed_dml_adaptive_object_relationship_list[i].left_token.name =
-                                                                                                                                       getParsedToken(left_token, &object_type);
+                       getParsedToken(left_token, &object_type);
                pool_config->parsed_dml_adaptive_object_relationship_list[i].left_token.object_type = object_type;
 
                pool_config->parsed_dml_adaptive_object_relationship_list[i].right_token.name =
-                                                                                                                                       getParsedToken(right_token,&object_type);
+                       getParsedToken(right_token, &object_type);
                pool_config->parsed_dml_adaptive_object_relationship_list[i].right_token.object_type = object_type;
                pfree(kvstr);
        }
@@ -5075,10 +5082,11 @@ MakeDMLAdaptiveObjectRelationList(char *newval, int elevel)
  * We also remove the trailing spaces from the function type token
  * and return the palloc'd copy of token in new_token
  */
-static char*
+static char *
 getParsedToken(char *token, DBObjectTypes *object_type)
 {
-       int len;
+       int                     len;
+
        *object_type = OBJECT_TYPE_UNKNOWN;
 
        if (!token)
@@ -5087,18 +5095,19 @@ getParsedToken(char *token, DBObjectTypes *object_type)
        len = strlen(token);
        if (len > strlen("*()"))
        {
-               int namelen = len - 2;
+               int                     namelen = len - 2;
+
                /* check if token ends with () */
-               if (strcmp(token + namelen,"()") == 0)
+               if (strcmp(token + namelen, "()") == 0)
                {
                        /*
-                        * Remove the Parentheses from end of
-                        * token name
+                        * Remove the Parentheses from end of token name
                         */
-                       char *new_token;
-                       int new_len = strlen(token) - 2;
+                       char       *new_token;
+                       int                     new_len = strlen(token) - 2;
+
                        new_token = palloc(new_len + 1);
-                       strncpy(new_token,token,new_len);
+                       strncpy(new_token, token, new_len);
                        new_token[new_len] = '\0';
                        *object_type = OBJECT_TYPE_FUNCTION;
                        return new_token;
@@ -5241,16 +5250,16 @@ static bool
 SetPgpoolNodeId(int elevel)
 {
        char            pgpool_node_id_file[POOLMAXPATHLEN + 1];
-       FILE            *fd;
-       int         length;
-       int         i;
+       FILE       *fd;
+       int                     length;
+       int                     i;
 
        if (g_pool_config.use_watchdog)
        {
                snprintf(pgpool_node_id_file, sizeof(pgpool_node_id_file), "%s/%s", config_file_dir, NODE_ID_FILE_NAME);
 
 #define MAXLINE 10
-               char        readbuf[MAXLINE];
+               char            readbuf[MAXLINE];
 
                fd = fopen(pgpool_node_id_file, "r");
                if (!fd)
@@ -5326,12 +5335,13 @@ SetPgpoolNodeId(int elevel)
 static bool
 SetHBDestIfFunc(int elevel)
 {
-       int             idx = 0;
-       char    **addrs;
-       char    **if_names;
-       int             i, j,
-                       n_addr,
-                       n_if_name;
+       int                     idx = 0;
+       char      **addrs;
+       char      **if_names;
+       int                     i,
+                               j,
+                               n_addr,
+                               n_if_name;
 
        g_pool_config.num_hb_dest_if = 0;
 
@@ -5342,10 +5352,10 @@ SetHBDestIfFunc(int elevel)
 
        /*
         * g_pool_config.hb_ifs is the information for sending/receiving heartbeat
-        * for all nodes specified in pgpool.conf.
-        * If it is local pgpool node information, set dest_port to g_pool_config.wd_heartbeat_port
-        * and ignore addr and if_name.
-        * g_pool_config.hb_dest_if is the heartbeat destination information.
+        * for all nodes specified in pgpool.conf. If it is local pgpool node
+        * information, set dest_port to g_pool_config.wd_heartbeat_port and
+        * ignore addr and if_name. g_pool_config.hb_dest_if is the heartbeat
+        * destination information.
         */
        for (i = 0; i < WD_MAX_IF_NUM; i++)
        {
@@ -5358,7 +5368,7 @@ SetHBDestIfFunc(int elevel)
                                continue;
                        }
 
-                       WdHbIf *hbNodeInfo = &g_pool_config.hb_ifs[i];
+                       WdHbIf     *hbNodeInfo = &g_pool_config.hb_ifs[i];
 
                        addrs = get_list_from_string(hbNodeInfo->addr, ";", &n_addr);
                        if_names = get_list_from_string(hbNodeInfo->if_name, ";", &n_if_name);
@@ -5383,7 +5393,7 @@ SetHBDestIfFunc(int elevel)
                        {
                                strlcpy(g_pool_config.hb_dest_if[idx].addr, addrs[j], WD_MAX_HOST_NAMELEN - 1);
                                g_pool_config.hb_dest_if[idx].dest_port = hbNodeInfo->dest_port;
-                               if (n_if_name > j )
+                               if (n_if_name > j)
                                {
                                        strlcpy(g_pool_config.hb_dest_if[idx].if_name, if_names[j], WD_MAX_IF_NAME_LEN - 1);
                                        pfree(if_names[j]);
@@ -5537,6 +5547,7 @@ parse_int(const char *value, int64 *result, int flags, const char **hintmsg, int
                *result = (int64) val;
        return true;
 }
+
 /*
  * Convert a value from one of the human-friendly units ("kB", "min" etc.)
  * to the given base unit.  'value' and 'unit' are the input value and unit
@@ -5935,7 +5946,7 @@ value_slot_for_config_record_is_empty(struct config_generic *record, int index)
 }
 
 bool
-set_config_option_for_session(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend, const char *name, const char *value)
+set_config_option_for_session(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, const char *name, const char *value)
 {
        bool            ret;
        MemoryContext oldCxt = MemoryContextSwitchTo(TopMemoryContext);
@@ -5950,7 +5961,7 @@ set_config_option_for_session(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL *
 }
 
 bool
-reset_all_variables(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend)
+reset_all_variables(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend)
 {
        int                     i;
        int                     elevel = (frontend == NULL) ? FATAL : FRONTEND_ONLY_ERROR;
@@ -6019,7 +6030,7 @@ reset_all_variables(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend)
  * Handle "pgpool show all" command.
 */
 bool
-report_all_variables(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend)
+report_all_variables(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend)
 {
        int                     i;
        int                     num_rows = 0;
@@ -6077,7 +6088,7 @@ report_all_variables(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend)
  * Handle "pgpool show" command.
 */
 bool
-report_config_variable(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend, const char *var_name)
+report_config_variable(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, const char *var_name)
 {
        int                     index = 0;
        char       *value;
@@ -6151,7 +6162,7 @@ report_config_variable(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backen
 }
 
 static int
-send_array_type_variable_to_frontend(struct config_generic *record, POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend)
+send_array_type_variable_to_frontend(struct config_generic *record, POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend)
 {
        if (record->dynamic_array_var)
        {
@@ -6192,7 +6203,7 @@ send_array_type_variable_to_frontend(struct config_generic *record, POOL_CONNECT
 }
 
 static int
-send_grouped_type_variable_to_frontend(struct config_grouped_array_var *grouped_record, POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend)
+send_grouped_type_variable_to_frontend(struct config_grouped_array_var *grouped_record, POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend)
 {
        int                     k,
                                index;
@@ -6243,7 +6254,7 @@ send_grouped_type_variable_to_frontend(struct config_grouped_array_var *grouped_
 }
 
 static void
-send_row_description_for_detail_view(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend)
+send_row_description_for_detail_view(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend)
 {
        static char *field_names[] = {"item", "value", "description"};
 
index 00a04ff8d1a9946dc12e9e4f7daec4127f45c8fb..da2913b6d3f4cd40b3e115c9851e8702665b58c8 100644 (file)
@@ -30,7 +30,7 @@
 #include "pool_config.h"               /* remove me afterwards */
 
 static POOL_PROCESS_CONTEXT process_context_d;
-static POOL_PROCESS_CONTEXT * process_context;
+static POOL_PROCESS_CONTEXT *process_context;
 
 /*
  * Initialize per process context
@@ -108,7 +108,7 @@ pool_increment_local_session_id(void)
 size_t
 pool_coninfo_size(void)
 {
-       size_t                  size;
+       size_t          size;
 
        size = pool_config->num_init_children *
                pool_config->max_pool *
@@ -264,13 +264,13 @@ pool_coninfo_backend_pid(int backend_pid, int *backend_node_id)
  * This flag is used to handle pg_terminate_backend()
  */
 void
-pool_set_connection_will_be_terminated(ConnectionInfo * connInfo)
+pool_set_connection_will_be_terminated(ConnectionInfo *connInfo)
 {
        connInfo->swallow_termination = 1;
 }
 
 void
-pool_unset_connection_will_be_terminated(ConnectionInfo * connInfo)
+pool_unset_connection_will_be_terminated(ConnectionInfo *connInfo)
 {
        connInfo->swallow_termination = 0;
 }
index d398bee6da52944f4c76cbced86166f57fe786d6..a4800d94b486ced8b9ef5c961cbedc9d19298e98 100644 (file)
@@ -48,7 +48,7 @@ typedef enum
        POOL_STANDBY,
        POOL_EITHER,
        POOL_BOTH
-}                      POOL_DEST;
+} POOL_DEST;
 
 #define CHECK_QUERY_CONTEXT_IS_VALID \
                                                do { \
@@ -58,9 +58,9 @@ typedef enum
                                                } while (0)
 
 static POOL_DEST send_to_where(Node *node);
-static void where_to_send_deallocate(POOL_QUERY_CONTEXT * query_context, Node *node);
-static void where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node *node);
-static void where_to_send_native_replication(POOL_QUERY_CONTEXT * query_context, char *query, Node *node);
+static void where_to_send_deallocate(POOL_QUERY_CONTEXT *query_context, Node *node);
+static void where_to_send_main_replica(POOL_QUERY_CONTEXT *query_context, char *query, Node *node);
+static void where_to_send_native_replication(POOL_QUERY_CONTEXT *query_context, char *query, Node *node);
 
 static char *remove_read_write(int len, const char *contents, int *rewritten_len);
 static void set_virtual_main_node(POOL_QUERY_CONTEXT *query_context);
@@ -70,8 +70,8 @@ static bool is_in_list(char *name, List *list);
 static bool is_select_object_in_temp_write_list(Node *node, void *context);
 static bool add_object_into_temp_write_list(Node *node, void *context);
 static void dml_adaptive(Node *node, char *query);
-static charget_associated_object_from_dml_adaptive_relations
-                                                       (char *left_token, DBObjectTypes object_type);
+static char *get_associated_object_from_dml_adaptive_relations
+                       (char *left_token, DBObjectTypes object_type);
 
 /*
  * Create and initialize per query session context
@@ -98,7 +98,7 @@ pool_init_query_context(void)
  * Destroy query context
  */
 void
-pool_query_context_destroy(POOL_QUERY_CONTEXT * query_context)
+pool_query_context_destroy(POOL_QUERY_CONTEXT *query_context)
 {
        POOL_SESSION_CONTEXT *session_context;
 
@@ -130,7 +130,7 @@ pool_query_context_destroy(POOL_QUERY_CONTEXT * query_context)
  * Perform shallow copy of given query context. Used in parse_before_bind.
  */
 POOL_QUERY_CONTEXT *
-pool_query_context_shallow_copy(POOL_QUERY_CONTEXT * query_context)
+pool_query_context_shallow_copy(POOL_QUERY_CONTEXT *query_context)
 {
        POOL_QUERY_CONTEXT *qc;
        MemoryContext memory_context;
@@ -146,7 +146,7 @@ pool_query_context_shallow_copy(POOL_QUERY_CONTEXT * query_context)
  * Start query
  */
 void
-pool_start_query(POOL_QUERY_CONTEXT * query_context, char *query, int len, Node *node)
+pool_start_query(POOL_QUERY_CONTEXT *query_context, char *query, int len, Node *node)
 {
        POOL_SESSION_CONTEXT *session_context;
 
@@ -180,7 +180,7 @@ pool_start_query(POOL_QUERY_CONTEXT * query_context, char *query, int len, Node
  * Specify DB node to send query
  */
 void
-pool_set_node_to_be_sent(POOL_QUERY_CONTEXT * query_context, int node_id)
+pool_set_node_to_be_sent(POOL_QUERY_CONTEXT *query_context, int node_id)
 {
        CHECK_QUERY_CONTEXT_IS_VALID;
 
@@ -198,7 +198,7 @@ pool_set_node_to_be_sent(POOL_QUERY_CONTEXT * query_context, int node_id)
  * Unspecified DB node to send query
  */
 void
-pool_unset_node_to_be_sent(POOL_QUERY_CONTEXT * query_context, int node_id)
+pool_unset_node_to_be_sent(POOL_QUERY_CONTEXT *query_context, int node_id)
 {
        CHECK_QUERY_CONTEXT_IS_VALID;
 
@@ -216,7 +216,7 @@ pool_unset_node_to_be_sent(POOL_QUERY_CONTEXT * query_context, int node_id)
  * Clear DB node map
  */
 void
-pool_clear_node_to_be_sent(POOL_QUERY_CONTEXT * query_context)
+pool_clear_node_to_be_sent(POOL_QUERY_CONTEXT *query_context)
 {
        CHECK_QUERY_CONTEXT_IS_VALID;
 
@@ -228,7 +228,7 @@ pool_clear_node_to_be_sent(POOL_QUERY_CONTEXT * query_context)
  * Set all DB node map entry
  */
 void
-pool_setall_node_to_be_sent(POOL_QUERY_CONTEXT * query_context)
+pool_setall_node_to_be_sent(POOL_QUERY_CONTEXT *query_context)
 {
        int                     i;
        POOL_SESSION_CONTEXT *sc;
@@ -245,8 +245,9 @@ pool_setall_node_to_be_sent(POOL_QUERY_CONTEXT * query_context)
                        if (SL_MODE)
                        {
                                /*
-                                * If load balance mode is disabled, only send to the primary node.
-                                * If primary node does not exist, send to the main node.
+                                * If load balance mode is disabled, only send to the primary
+                                * node. If primary node does not exist, send to the main
+                                * node.
                                 */
                                if (!pool_config->load_balance_mode)
                                {
@@ -259,6 +260,7 @@ pool_setall_node_to_be_sent(POOL_QUERY_CONTEXT * query_context)
                                        continue;
                                }
                                else
+
                                        /*
                                         * If the node is not primary node nor load balance node,
                                         * there's no point to send query except statement level
@@ -266,7 +268,7 @@ pool_setall_node_to_be_sent(POOL_QUERY_CONTEXT * query_context)
                                         */
                                        if (!pool_config->statement_level_load_balance &&
                                                i != PRIMARY_NODE_ID && i != sc->load_balance_node_id)
-                                               continue;
+                                       continue;
                        }
                        query_context->where_to_send[i] = true;
                }
@@ -278,7 +280,7 @@ pool_setall_node_to_be_sent(POOL_QUERY_CONTEXT * query_context)
  * Return true if multiple nodes are targets
  */
 bool
-pool_multi_node_to_be_sent(POOL_QUERY_CONTEXT * query_context)
+pool_multi_node_to_be_sent(POOL_QUERY_CONTEXT *query_context)
 {
        int                     i;
        int                     cnt = 0;
@@ -305,7 +307,7 @@ pool_multi_node_to_be_sent(POOL_QUERY_CONTEXT * query_context)
  * Return if the DB node is needed to send query
  */
 bool
-pool_is_node_to_be_sent(POOL_QUERY_CONTEXT * query_context, int node_id)
+pool_is_node_to_be_sent(POOL_QUERY_CONTEXT *query_context, int node_id)
 {
        CHECK_QUERY_CONTEXT_IS_VALID;
 
@@ -346,12 +348,12 @@ pool_is_node_to_be_sent_in_current_query(int node_id)
 int
 pool_virtual_main_db_node_id(void)
 {
-       volatile POOL_REQUEST_INFO      *my_req;
+       volatile POOL_REQUEST_INFO *my_req;
        POOL_SESSION_CONTEXT *sc;
 
        /*
-        * Check whether failover is in progress and we are child process.
-        * If so, we will wait for failover to finish.
+        * Check whether failover is in progress and we are child process. If so,
+        * we will wait for failover to finish.
         */
        my_req = Req_info;
        if (processType == PT_CHILD && my_req->switching)
@@ -360,17 +362,19 @@ pool_virtual_main_db_node_id(void)
                POOL_SETMASK(&BlockSig);
                ereport(WARNING,
                                (errmsg("failover/failback is in progress"),
-                                               errdetail("executing failover or failback on backend"),
+                                errdetail("executing failover or failback on backend"),
                                 errhint("In a moment you should be able to reconnect to the database")));
                POOL_SETMASK(&UnBlockSig);
 #endif
+
                /*
                 * Wait for failover to finish
                 */
                if (wait_for_failover_to_finish() == -2)
+
                        /*
-                        * Waiting for failover/failback to finish was timed out.
-                        * Time to exit this process (and session disconnection).
+                        * Waiting for failover/failback to finish was timed out. Time to
+                        * exit this process (and session disconnection).
                         */
                        child_exit(POOL_EXIT_AND_RESTART);
        }
@@ -380,9 +384,9 @@ pool_virtual_main_db_node_id(void)
        {
                /*
                 * We used to return REAL_MAIN_NODE_ID here.  Problem with it is, it
-                * is possible that REAL_MAIN_NODE_ID could be changed
-                * anytime. Suppose REAL_MAIN_NODE_ID == my_main_node_id == 1. Then
-                * due to failback, REAL_MAIN_NODE_ID is changed to 0. Then
+                * is possible that REAL_MAIN_NODE_ID could be changed anytime.
+                * Suppose REAL_MAIN_NODE_ID == my_main_node_id == 1. Then due to
+                * failback, REAL_MAIN_NODE_ID is changed to 0. Then
                 * MAIN_CONNECTION(cp) will return NULL and any reference to it will
                 * cause segmentation fault. To prevent the issue we should return
                 * my_main_node_id instead.
@@ -430,9 +434,9 @@ pool_virtual_main_db_node_id(void)
        }
 
        /*
-        * No query context exists.  If in streaming replication mode, returns primary node
-        * if exists.  Otherwise returns my_main_node_id, which represents the
-        * last REAL_MAIN_NODE_ID.
+        * No query context exists.  If in streaming replication mode, returns
+        * primary node if exists.  Otherwise returns my_main_node_id, which
+        * represents the last REAL_MAIN_NODE_ID.
         */
        if (MAIN_REPLICA)
        {
@@ -445,7 +449,7 @@ pool_virtual_main_db_node_id(void)
  * Set the destination for the current query to the specific backend node.
  */
 void
-pool_force_query_node_to_backend(POOL_QUERY_CONTEXT * query_context, int backend_id)
+pool_force_query_node_to_backend(POOL_QUERY_CONTEXT *query_context, int backend_id)
 {
        CHECK_QUERY_CONTEXT_IS_VALID;
 
@@ -460,7 +464,7 @@ pool_force_query_node_to_backend(POOL_QUERY_CONTEXT * query_context, int backend
  * Decide where to send queries(thus expecting response)
  */
 void
-pool_where_to_send(POOL_QUERY_CONTEXT * query_context, char *query, Node *node)
+pool_where_to_send(POOL_QUERY_CONTEXT *query_context, char *query, Node *node)
 {
        CHECK_QUERY_CONTEXT_IS_VALID;
 
@@ -481,14 +485,15 @@ pool_where_to_send(POOL_QUERY_CONTEXT * query_context, char *query, Node *node)
                if (query_context->is_multi_statement)
                {
                        /*
-                        * If we are in streaming replication mode and we have multi statement query,
-                        * we should send it to primary server only. Otherwise it is possible
-                        * to send a write query to standby servers because we only use the
-                        * first element of the multi statement query and don't care about the
-                        * rest.  Typical situation where we are bugged by this is,
-                        * "BEGIN;DELETE FROM table;END". Note that from pgpool-II 3.1.0
-                        * transactional statements such as "BEGIN" is unconditionally sent to
-                        * all nodes(see send_to_where() for more details). Someday we might
+                        * If we are in streaming replication mode and we have multi
+                        * statement query, we should send it to primary server only.
+                        * Otherwise it is possible to send a write query to standby
+                        * servers because we only use the first element of the multi
+                        * statement query and don't care about the rest.  Typical
+                        * situation where we are bugged by this is, "BEGIN;DELETE FROM
+                        * table;END". Note that from pgpool-II 3.1.0 transactional
+                        * statements such as "BEGIN" is unconditionally sent to all
+                        * nodes(see send_to_where() for more details). Someday we might
                         * be able to understand all part of multi statement queries, but
                         * until that day we need this band aid.
                         */
@@ -535,7 +540,7 @@ pool_where_to_send(POOL_QUERY_CONTEXT * query_context, char *query, Node *node)
  *  >0: send to this node_id
  */
 POOL_STATUS
-pool_send_and_wait(POOL_QUERY_CONTEXT * query_context,
+pool_send_and_wait(POOL_QUERY_CONTEXT *query_context,
                                   int send_type, int node_id)
 {
        POOL_SESSION_CONTEXT *session_context;
@@ -556,10 +561,10 @@ pool_send_and_wait(POOL_QUERY_CONTEXT * query_context,
        string = NULL;
 
        /*
-        * If the query is BEGIN READ WRITE or BEGIN ... SERIALIZABLE in
-        * streaming replication mode, we send BEGIN to standbys instead.
-        * The original_query which is BEGIN READ WRITE is sent to primary.
-        * The rewritten_query BEGIN is sent to standbys.
+        * If the query is BEGIN READ WRITE or BEGIN ... SERIALIZABLE in streaming
+        * replication mode, we send BEGIN to standbys instead. The original_query
+        * which is BEGIN READ WRITE is sent to primary. The rewritten_query BEGIN
+        * is sent to standbys.
         */
        if (pool_need_to_treat_as_if_default_transaction(query_context))
        {
@@ -590,8 +595,9 @@ pool_send_and_wait(POOL_QUERY_CONTEXT * query_context,
                        continue;
 
                /*
-                * If we are in streaming replication mode or logical replication mode,
-                * we do not send COMMIT/ABORT to standbys if it's in I (idle) state.
+                * If we are in streaming replication mode or logical replication
+                * mode, we do not send COMMIT/ABORT to standbys if it's in I (idle)
+                * state.
                 */
                if (is_commit && MAIN_REPLICA && !IS_MAIN_NODE_ID(i) && TSTATE(backend, i) == 'I')
                {
@@ -692,7 +698,7 @@ pool_send_and_wait(POOL_QUERY_CONTEXT * query_context,
  *  >0: send to this node_id
  */
 POOL_STATUS
-pool_extended_send_and_wait(POOL_QUERY_CONTEXT * query_context,
+pool_extended_send_and_wait(POOL_QUERY_CONTEXT *query_context,
                                                        char *kind, int len, char *contents,
                                                        int send_type, int node_id, bool nowait)
 {
@@ -718,10 +724,10 @@ pool_extended_send_and_wait(POOL_QUERY_CONTEXT * query_context,
        rewritten_begin = NULL;
 
        /*
-        * If the query is BEGIN READ WRITE or BEGIN ... SERIALIZABLE in
-        * streaming replication mode, we send BEGIN to standbys instead.
-        * The original_query which is BEGIN READ WRITE is sent to primary.
-        * The rewritten_query BEGIN is sent to standbys.
+        * If the query is BEGIN READ WRITE or BEGIN ... SERIALIZABLE in streaming
+        * replication mode, we send BEGIN to standbys instead. The original_query
+        * which is BEGIN READ WRITE is sent to primary. The rewritten_query BEGIN
+        * is sent to standbys.
         */
        if (pool_need_to_treat_as_if_default_transaction(query_context))
        {
@@ -903,7 +909,8 @@ pool_extended_send_and_wait(POOL_QUERY_CONTEXT * query_context,
  * From syntactically analysis decide the statement to be sent to the
  * primary, the standby or either or both in native replication+HR/SR mode.
  */
-static POOL_DEST send_to_where(Node *node)
+static POOL_DEST
+send_to_where(Node *node)
 
 {
 /* From storage/lock.h */
@@ -981,15 +988,15 @@ static POOL_DEST send_to_where(Node *node)
                if (is_start_transaction_query(node))
                {
                        /*
-                        * But actually, we send BEGIN to standby if it's BEGIN READ
-                        * WRITE or START TRANSACTION READ WRITE
+                        * But actually, we send BEGIN to standby if it's BEGIN READ WRITE
+                        * or START TRANSACTION READ WRITE
                         */
                        if (is_read_write((TransactionStmt *) node))
                                return POOL_BOTH;
 
                        /*
-                        * Other TRANSACTION start commands are sent to both primary
-                        * and standby
+                        * Other TRANSACTION start commands are sent to both primary and
+                        * standby
                         */
                        else
                                return POOL_BOTH;
@@ -1009,6 +1016,7 @@ static POOL_DEST send_to_where(Node *node)
                        }
                        return POOL_BOTH;
                }
+
                /*
                 * 2PC commands
                 */
@@ -1059,8 +1067,8 @@ static POOL_DEST send_to_where(Node *node)
 
                /*
                 * SET TRANSACTION ISOLATION LEVEL SERIALIZABLE or SET SESSION
-                * CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE or
-                * SET transaction_isolation TO 'serializable' SET
+                * CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE or SET
+                * transaction_isolation TO 'serializable' SET
                 * default_transaction_isolation TO 'serializable'
                 */
                else if (is_set_transaction_serializable(node))
@@ -1069,8 +1077,8 @@ static POOL_DEST send_to_where(Node *node)
                }
 
                /*
-                * Check "SET TRANSACTION READ WRITE" "SET SESSION CHARACTERISTICS
-                * AS TRANSACTION READ WRITE"
+                * Check "SET TRANSACTION READ WRITE" "SET SESSION CHARACTERISTICS AS
+                * TRANSACTION READ WRITE"
                 */
                else if (((VariableSetStmt *) node)->kind == VAR_SET_MULTI &&
                                 (!strcmp(((VariableSetStmt *) node)->name, "TRANSACTION") ||
@@ -1165,11 +1173,11 @@ static POOL_DEST send_to_where(Node *node)
  */
 static
 void
-where_to_send_deallocate(POOL_QUERY_CONTEXT * query_context, Node *node)
+where_to_send_deallocate(POOL_QUERY_CONTEXT *query_context, Node *node)
 {
        DeallocateStmt *d = NULL;
        ExecuteStmt *e = NULL;
-       char            *name;
+       char       *name;
        POOL_SENT_MESSAGE *msg;
 
        if (IsA(node, DeallocateStmt))
@@ -1217,12 +1225,10 @@ where_to_send_deallocate(POOL_QUERY_CONTEXT * query_context, Node *node)
                else
                {
                        /*
-                        * prepared statement was not found.
-                        * There are two cases when this could happen.
-                        * (1) mistakes by client. In this case backend will return ERROR
-                        * anyway.
-                        * (2) previous query was issued as multi-statement query. e.g.
-                        * SELECT 1\;PREPARE foo AS SELECT 1;
+                        * prepared statement was not found. There are two cases when this
+                        * could happen. (1) mistakes by client. In this case backend will
+                        * return ERROR anyway. (2) previous query was issued as
+                        * multi-statement query. e.g. SELECT 1\;PREPARE foo AS SELECT 1;
                         * In this case pgpool does not know anything about the prepared
                         * statement "foo".
                         */
@@ -1431,7 +1437,7 @@ is_serializable(TransactionStmt *node)
  * The rewritten_query BEGIN is sent to standbys.
  */
 bool
-pool_need_to_treat_as_if_default_transaction(POOL_QUERY_CONTEXT * query_context)
+pool_need_to_treat_as_if_default_transaction(POOL_QUERY_CONTEXT *query_context)
 {
        return (MAIN_REPLICA &&
                        is_start_transaction_query(query_context->parse_tree) &&
@@ -1471,7 +1477,7 @@ is_2pc_transaction_query(Node *node)
  * Set query state, if a current state is before it than the specified state.
  */
 void
-pool_set_query_state(POOL_QUERY_CONTEXT * query_context, POOL_QUERY_STATE state)
+pool_set_query_state(POOL_QUERY_CONTEXT *query_context, POOL_QUERY_STATE state)
 {
        int                     i;
 
@@ -1755,7 +1761,7 @@ pool_is_transaction_read_only(Node *node)
 static void
 set_virtual_main_node(POOL_QUERY_CONTEXT *query_context)
 {
-       int     i;
+       int                     i;
 
        for (i = 0; i < NUM_BACKENDS; i++)
        {
@@ -1774,6 +1780,7 @@ static void
 set_load_balance_info(POOL_QUERY_CONTEXT *query_context)
 {
        POOL_SESSION_CONTEXT *session_context;
+
        session_context = pool_get_session_context(false);
 
        if (pool_config->statement_level_load_balance)
@@ -1794,10 +1801,12 @@ is_in_list(char *name, List *list)
        if (name == NULL || list == NIL)
                return false;
 
-       ListCell *cell;
-       foreach (cell, list)
+       ListCell   *cell;
+
+       foreach(cell, list)
        {
-               char *cell_name = (char *)lfirst(cell);
+               char       *cell_name = (char *) lfirst(cell);
+
                if (strcasecmp(name, cell_name) == 0)
                {
                        ereport(DEBUG1,
@@ -1826,7 +1835,7 @@ is_select_object_in_temp_write_list(Node *node, void *context)
                if (pool_config->disable_load_balance_on_write == DLBOW_DML_ADAPTIVE && session_context->is_in_transaction)
                {
                        ereport(DEBUG1,
-                                       (errmsg("is_select_object_in_temp_write_list: \"%s\", found relation \"%s\"", (char*)context, rgv->relname)));
+                                       (errmsg("is_select_object_in_temp_write_list: \"%s\", found relation \"%s\"", (char *) context, rgv->relname)));
 
                        return is_in_list(rgv->relname, session_context->transaction_temp_write_list);
                }
@@ -1835,15 +1844,15 @@ is_select_object_in_temp_write_list(Node *node, void *context)
        return raw_expression_tree_walker(node, is_select_object_in_temp_write_list, context);
 }
 
-static char*
-get_associated_object_from_dml_adaptive_relations
-                                               (char *left_token, DBObjectTypes object_type)
+static char *get_associated_object_from_dml_adaptive_relations
+                       (char *left_token, DBObjectTypes object_type)
 {
-       int i;
-       char *right_token = NULL;
+       int                     i;
+       char       *right_token = NULL;
+
        if (!pool_config->parsed_dml_adaptive_object_relationship_list)
                return NULL;
-       for (i=0 ;; i++)
+       for (i = 0;; i++)
        {
                if (pool_config->parsed_dml_adaptive_object_relationship_list[i].left_token.name == NULL)
                        break;
@@ -1873,13 +1882,14 @@ check_object_relationship_list(char *name, bool is_func_name)
 
                if (session_context->is_in_transaction)
                {
-                       char    *right_token =
-                                               get_associated_object_from_dml_adaptive_relations
-                                                       (name, is_func_name? OBJECT_TYPE_FUNCTION : OBJECT_TYPE_RELATION);
+                       char       *right_token =
+                               get_associated_object_from_dml_adaptive_relations
+                               (name, is_func_name ? OBJECT_TYPE_FUNCTION : OBJECT_TYPE_RELATION);
 
                        if (right_token)
                        {
                                MemoryContext old_context = MemoryContextSwitchTo(session_context->memory_context);
+
                                session_context->transaction_temp_write_list =
                                        lappend(session_context->transaction_temp_write_list, pstrdup(right_token));
                                MemoryContextSwitchTo(old_context);
@@ -1903,7 +1913,7 @@ add_object_into_temp_write_list(Node *node, void *context)
                RangeVar   *rgv = (RangeVar *) node;
 
                ereport(DEBUG5,
-                               (errmsg("add_object_into_temp_write_list: \"%s\", found relation \"%s\"", (char*)context, rgv->relname)));
+                               (errmsg("add_object_into_temp_write_list: \"%s\", found relation \"%s\"", (char *) context, rgv->relname)));
 
                POOL_SESSION_CONTEXT *session_context = pool_get_session_context(false);
                MemoryContext old_context = MemoryContextSwitchTo(session_context->memory_context);
@@ -1947,7 +1957,7 @@ dml_adaptive(Node *node, char *query)
 
                                session_context->transaction_temp_write_list = NIL;
                        }
-                       else if(is_commit_or_rollback_query(node))
+                       else if (is_commit_or_rollback_query(node))
                        {
                                session_context->is_in_transaction = false;
 
@@ -1961,7 +1971,10 @@ dml_adaptive(Node *node, char *query)
                        return;
                }
 
-               /* If non-selectStmt, find the relname and add it to the transaction temp write list. */
+               /*
+                * If non-selectStmt, find the relname and add it to the transaction
+                * temp write list.
+                */
                if (!is_select_query(node, query))
                        add_object_into_temp_write_list(node, query);
 
@@ -1973,7 +1986,7 @@ dml_adaptive(Node *node, char *query)
  * replication mode and slony mode.  Called by pool_where_to_send.
  */
 static void
-where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node *node)
+where_to_send_main_replica(POOL_QUERY_CONTEXT *query_context, char *query, Node *node)
 {
        POOL_DEST       dest;
        POOL_SESSION_CONTEXT *session_context;
@@ -2000,11 +2013,10 @@ where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node
                if (is_tx_started_by_multi_statement_query())
                {
                        /*
-                        * If we are in an explicit transaction and the transaction
-                        * was started by a multi statement query, we should send
-                        * query to primary node only (which was supposed to be sent
-                        * to all nodes) until the transaction gets committed or
-                        * aborted.
+                        * If we are in an explicit transaction and the transaction was
+                        * started by a multi statement query, we should send query to
+                        * primary node only (which was supposed to be sent to all nodes)
+                        * until the transaction gets committed or aborted.
                         */
                        pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID);
                }
@@ -2030,9 +2042,9 @@ where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node
                {
                        /*
                         * If (we are outside of an explicit transaction) OR (the
-                        * transaction has not issued a write query yet, AND
-                        * transaction isolation level is not SERIALIZABLE) we might
-                        * be able to load balance.
+                        * transaction has not issued a write query yet, AND transaction
+                        * isolation level is not SERIALIZABLE) we might be able to load
+                        * balance.
                         */
 
                        ereport(DEBUG1,
@@ -2053,14 +2065,14 @@ where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node
                                 */
 
                                /*
-                                * If system catalog is used in the SELECT, we prefer to
-                                * send to the primary. Example: SELECT * FROM pg_class
-                                * WHERE relname = 't1'; Because 't1' is a constant, it's
-                                * hard to recognize as table name.  Most use case such
-                                * query is against system catalog, and the table name can
-                                * be a temporary table, it's best to query against
-                                * primary system catalog. Please note that this test must
-                                * be done *before* test using pool_has_temp_table.
+                                * If system catalog is used in the SELECT, we prefer to send
+                                * to the primary. Example: SELECT * FROM pg_class WHERE
+                                * relname = 't1'; Because 't1' is a constant, it's hard to
+                                * recognize as table name.  Most use case such query is
+                                * against system catalog, and the table name can be a
+                                * temporary table, it's best to query against primary system
+                                * catalog. Please note that this test must be done *before*
+                                * test using pool_has_temp_table.
                                 */
                                if (pool_has_system_catalog(node))
                                {
@@ -2072,8 +2084,8 @@ where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node
                                }
 
                                /*
-                                * If temporary table is used in the SELECT, we prefer to
-                                * send to the primary.
+                                * If temporary table is used in the SELECT, we prefer to send
+                                * to the primary.
                                 */
                                else if (pool_config->check_temp_table && pool_has_temp_table(node))
                                {
@@ -2085,8 +2097,8 @@ where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node
                                }
 
                                /*
-                                * If unlogged table is used in the SELECT, we prefer to
-                                * send to the primary.
+                                * If unlogged table is used in the SELECT, we prefer to send
+                                * to the primary.
                                 */
                                else if (pool_config->check_unlogged_table && pool_has_unlogged_table(node))
                                {
@@ -2096,17 +2108,20 @@ where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node
 
                                        pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID);
                                }
+
                                /*
-                                * When query match the query patterns in primary_routing_query_pattern_list, we
-                                * send only to main node.
+                                * When query match the query patterns in
+                                * primary_routing_query_pattern_list, we send only to main
+                                * node.
                                 */
                                else if (pattern_compare(query, WRITELIST, "primary_routing_query_pattern_list") == 1)
                                {
                                        pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID);
                                }
+
                                /*
-                                * If a writing function call is used, we prefer to send
-                                * to the primary.
+                                * If a writing function call is used, we prefer to send to
+                                * the primary.
                                 */
                                else if (pool_has_function_call(node))
                                {
@@ -2129,9 +2144,9 @@ where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node
 
                                        /*
                                         * As streaming replication delay is too much, if
-                                        * prefer_lower_delay_standby is true then elect new
-                                        * load balance node which is lowest delayed,
-                                        * false then send to the primary.
+                                        * prefer_lower_delay_standby is true then elect new load
+                                        * balance node which is lowest delayed, false then send
+                                        * to the primary.
                                         */
                                        if (STREAM && check_replication_delay(session_context->load_balance_node_id))
                                        {
@@ -2141,7 +2156,7 @@ where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node
 
                                                if (pool_config->prefer_lower_delay_standby)
                                                {
-                                                       int new_load_balancing_node = select_load_balancing_node();
+                                                       int                     new_load_balancing_node = select_load_balancing_node();
 
                                                        session_context->load_balance_node_id = new_load_balancing_node;
                                                        session_context->query_context->load_balance_node_id = session_context->load_balance_node_id;
@@ -2180,7 +2195,7 @@ where_to_send_main_replica(POOL_QUERY_CONTEXT * query_context, char *query, Node
  * Called by pool_where_to_send.
  */
 static void
-where_to_send_native_replication(POOL_QUERY_CONTEXT * query_context, char *query, Node *node)
+where_to_send_native_replication(POOL_QUERY_CONTEXT *query_context, char *query, Node *node)
 {
        POOL_SESSION_CONTEXT *session_context;
        POOL_CONNECTION_POOL *backend;
@@ -2193,7 +2208,7 @@ where_to_send_native_replication(POOL_QUERY_CONTEXT * query_context, char *query
         * from syntactical point of view).
         */
        elog(DEBUG1, "Maybe: load balance mode: %d is_select_query: %d",
-                        pool_config->load_balance_mode, is_select_query(node, query));
+                pool_config->load_balance_mode, is_select_query(node, query));
 
        if (pool_config->load_balance_mode &&
                is_select_query(node, query) &&
@@ -2223,12 +2238,12 @@ where_to_send_native_replication(POOL_QUERY_CONTEXT * query_context, char *query
                        else if (TSTATE(backend, MAIN_NODE_ID) == 'I')
                        {
                                /*
-                                * We are out side transaction. If default transaction is read only,
-                                * we can load balance.
+                                * We are out side transaction. If default transaction is read
+                                * only, we can load balance.
                                 */
-                               static  char *si_query = "SELECT current_setting('transaction_read_only')";
+                               static char *si_query = "SELECT current_setting('transaction_read_only')";
                                POOL_SELECT_RESULT *res;
-                               bool    load_balance = false;
+                               bool            load_balance = false;
 
                                do_query(CONNECTION(backend, MAIN_NODE_ID), si_query, &res, MAJOR(backend));
                                if (res)
@@ -2251,7 +2266,7 @@ where_to_send_native_replication(POOL_QUERY_CONTEXT * query_context, char *query
                                }
                        }
                }
-                       
+
                /*
                 * If a writing function call is used or replicate_select is true, we
                 * have to send to all nodes since the function may modify database.
@@ -2264,10 +2279,9 @@ where_to_send_native_replication(POOL_QUERY_CONTEXT * query_context, char *query
                }
 
                /*
-                * If (we are outside of an explicit transaction) OR (the
-                * transaction has not issued a write query yet, AND transaction
-                * isolation level is not SERIALIZABLE) we might be able to load
-                * balance.
+                * If (we are outside of an explicit transaction) OR (the transaction
+                * has not issued a write query yet, AND transaction isolation level
+                * is not SERIALIZABLE) we might be able to load balance.
                 */
                else if (TSTATE(backend, MAIN_NODE_ID) == 'I' ||
                                 (!pool_is_writing_transaction() &&
@@ -2314,22 +2328,23 @@ where_to_send_native_replication(POOL_QUERY_CONTEXT * query_context, char *query
 int
 wait_for_failover_to_finish(void)
 {
-#define        MAX_FAILOVER_WAIT       30      /* waiting for failover finish timeout in seconds */
+#define        MAX_FAILOVER_WAIT       30      /* waiting for failover finish timeout in
+                                                                * seconds */
 
-       volatile POOL_REQUEST_INFO      *my_req;
-       int             ret = 0;
-       int             i;
+       volatile POOL_REQUEST_INFO *my_req;
+       int                     ret = 0;
+       int                     i;
 
        /*
         * Wait for failover to finish
         */
-       for (i = 0;i < MAX_FAILOVER_WAIT; i++)
+       for (i = 0; i < MAX_FAILOVER_WAIT; i++)
        {
                my_req = Req_info;
                if (my_req->switching == 0)
                        return ret;
-               ret = -1;       /* failover/failback finished */
+               ret = -1;                               /* failover/failback finished */
                sleep(1);
        }
-       return -2;      /* timed out */
+       return -2;                                      /* timed out */
 }
index eea8df13601a6d5ea7e794daf1a92bc2b2fc5a9f..6ed64b2dec0f73daa06213c41071e8bc142837f2 100644 (file)
 #include "context/pool_session_context.h"
 
 static POOL_SESSION_CONTEXT session_context_d;
-static POOL_SESSION_CONTEXT * session_context = NULL;
+static POOL_SESSION_CONTEXT *session_context = NULL;
 static void GetTranIsolationErrorCb(void *arg);
 static void init_sent_message_list(void);
-static POOL_PENDING_MESSAGE * copy_pending_message(POOL_PENDING_MESSAGE * message);
-static void dump_sent_message(char *caller, POOL_SENT_MESSAGE * m);
+static POOL_PENDING_MESSAGE *copy_pending_message(POOL_PENDING_MESSAGE *message);
+static void dump_sent_message(char *caller, POOL_SENT_MESSAGE *m);
 static void dml_adaptive_init(void);
 static void dml_adaptive_destroy(void);
 
@@ -52,7 +52,7 @@ static int    Elevel = DEBUG2;
  * Initialize per session context
  */
 void
-pool_init_session_context(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend)
+pool_init_session_context(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend)
 {
        session_context = &session_context_d;
        ProcessInfo *process_info;
@@ -161,7 +161,7 @@ pool_init_session_context(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * bac
 
        /* Initialize temp tables */
        pool_temp_tables_init();
-       
+
        /* Snapshot isolation state */
        session_context->si_state = SI_NO_SNAPSHOT;
 
@@ -434,7 +434,7 @@ pool_remove_sent_messages(char kind)
  * Destroy sent message
  */
 void
-pool_sent_message_destroy(POOL_SENT_MESSAGE * message)
+pool_sent_message_destroy(POOL_SENT_MESSAGE *message)
 {
        bool            in_progress;
        POOL_QUERY_CONTEXT *qc = NULL;
@@ -522,7 +522,7 @@ pool_zap_query_context_in_sent_messages(POOL_QUERY_CONTEXT *query_context)
 }
 
 static void
-dump_sent_message(char *caller, POOL_SENT_MESSAGE * m)
+dump_sent_message(char *caller, POOL_SENT_MESSAGE *m)
 {
        ereport(DEBUG5,
                        (errmsg("called by %s: sent message: address: %p kind: %c name: =%s= state:%d",
@@ -560,7 +560,7 @@ dml_adaptive_destroy(void)
 POOL_SENT_MESSAGE *
 pool_create_sent_message(char kind, int len, char *contents,
                                                 int num_tsparams, const char *name,
-                                                POOL_QUERY_CONTEXT * query_context)
+                                                POOL_QUERY_CONTEXT *query_context)
 {
        POOL_SENT_MESSAGE *msg;
 
@@ -589,7 +589,7 @@ pool_create_sent_message(char kind, int len, char *contents,
  * Add a sent message to sent message list
  */
 void
-pool_add_sent_message(POOL_SENT_MESSAGE * message)
+pool_add_sent_message(POOL_SENT_MESSAGE *message)
 {
        POOL_SENT_MESSAGE *old_msg;
        POOL_SENT_MESSAGE_LIST *msglist;
@@ -682,7 +682,7 @@ pool_get_sent_message(char kind, const char *name, POOL_SENT_MESSAGE_STATE state
  * Find a sent message by query context.
  */
 POOL_SENT_MESSAGE *
-pool_get_sent_message_by_query_context(POOL_QUERY_CONTEXT * query_context)
+pool_get_sent_message_by_query_context(POOL_QUERY_CONTEXT *query_context)
 {
        int                     i;
        POOL_SENT_MESSAGE_LIST *msglist;
@@ -705,7 +705,7 @@ pool_get_sent_message_by_query_context(POOL_QUERY_CONTEXT * query_context)
  * Set message state to POOL_SENT_MESSAGE_STATE to POOL_SENT_MESSAGE_CLOSED.
  */
 void
-pool_set_sent_message_state(POOL_SENT_MESSAGE * message)
+pool_set_sent_message_state(POOL_SENT_MESSAGE *message)
 {
        ereport(DEBUG5,
                        (errmsg("pool_set_sent_message_state: name:%s kind:%c previous state: %d",
@@ -738,8 +738,8 @@ void
 pool_set_writing_transaction(void)
 {
        /*
-        * If disable_transaction_on_write is 'off' or 'dml_adaptive', then never turn on writing
-        * transaction flag.
+        * If disable_transaction_on_write is 'off' or 'dml_adaptive', then never
+        * turn on writing transaction flag.
         */
        if (pool_config->disable_load_balance_on_write != DLBOW_OFF && pool_config->disable_load_balance_on_write != DLBOW_DML_ADAPTIVE)
        {
@@ -968,7 +968,7 @@ init_sent_message_list(void)
  * is used. Returns true if it is not used.
  */
 bool
-can_query_context_destroy(POOL_QUERY_CONTEXT * qc)
+can_query_context_destroy(POOL_QUERY_CONTEXT *qc)
 {
        int                     i;
        int                     count = 0;
@@ -1125,7 +1125,7 @@ pool_pending_message_create(char kind, int len, char *contents)
  * message was sent.
  */
 void
-pool_pending_message_dest_set(POOL_PENDING_MESSAGE * message, POOL_QUERY_CONTEXT * query_context)
+pool_pending_message_dest_set(POOL_PENDING_MESSAGE *message, POOL_QUERY_CONTEXT *query_context)
 {
        memcpy(message->node_ids, query_context->where_to_send, sizeof(message->node_ids));
 
@@ -1142,7 +1142,7 @@ pool_pending_message_dest_set(POOL_PENDING_MESSAGE * message, POOL_QUERY_CONTEXT
  * which indicates which backend nodes the message was sent.
  */
 void
-pool_pending_message_query_context_dest_set(POOL_PENDING_MESSAGE * message, POOL_QUERY_CONTEXT * query_context)
+pool_pending_message_query_context_dest_set(POOL_PENDING_MESSAGE *message, POOL_QUERY_CONTEXT *query_context)
 {
        int                     i;
 
@@ -1168,7 +1168,7 @@ pool_pending_message_query_context_dest_set(POOL_PENDING_MESSAGE * message, POOL
  * Set query field of message.
  */
 void
-pool_pending_message_query_set(POOL_PENDING_MESSAGE * message, POOL_QUERY_CONTEXT * query_context)
+pool_pending_message_query_set(POOL_PENDING_MESSAGE *message, POOL_QUERY_CONTEXT *query_context)
 {
        StrNCpy(message->query, query_context->original_query, sizeof(message->query));
 }
@@ -1177,7 +1177,7 @@ pool_pending_message_query_set(POOL_PENDING_MESSAGE * message, POOL_QUERY_CONTEX
  * Add one message to the tail of the list.
  */
 void
-pool_pending_message_add(POOL_PENDING_MESSAGE * message)
+pool_pending_message_add(POOL_PENDING_MESSAGE *message)
 {
        MemoryContext old_context;
 
@@ -1354,7 +1354,7 @@ pool_pending_message_get(POOL_MESSAGE_TYPE type)
  * close message.
  */
 char
-pool_get_close_message_spec(POOL_PENDING_MESSAGE * msg)
+pool_get_close_message_spec(POOL_PENDING_MESSAGE *msg)
 {
        return *msg->contents;
 }
@@ -1364,7 +1364,7 @@ pool_get_close_message_spec(POOL_PENDING_MESSAGE * msg)
  * The returned pointer is within "msg".
  */
 char *
-pool_get_close_message_name(POOL_PENDING_MESSAGE * msg)
+pool_get_close_message_name(POOL_PENDING_MESSAGE *msg)
 {
        return (msg->contents) + 1;
 }
@@ -1373,7 +1373,8 @@ pool_get_close_message_name(POOL_PENDING_MESSAGE * msg)
  * Perform deep copy of POOL_PENDING_MESSAGE object in the current memory
  * context except the query context.
  */
-static POOL_PENDING_MESSAGE * copy_pending_message(POOL_PENDING_MESSAGE * message)
+static POOL_PENDING_MESSAGE *
+copy_pending_message(POOL_PENDING_MESSAGE *message)
 {
        POOL_PENDING_MESSAGE *msg;
 
@@ -1390,7 +1391,7 @@ static POOL_PENDING_MESSAGE * copy_pending_message(POOL_PENDING_MESSAGE * messag
  * context except the query context.
  */
 void
-pool_pending_message_free_pending_message(POOL_PENDING_MESSAGE * message)
+pool_pending_message_free_pending_message(POOL_PENDING_MESSAGE *message)
 {
        if (message == NULL)
                return;
@@ -1420,7 +1421,7 @@ pool_pending_message_reset_previous_message(void)
  * Set previous message.
  */
 void
-pool_pending_message_set_previous_message(POOL_PENDING_MESSAGE * message)
+pool_pending_message_set_previous_message(POOL_PENDING_MESSAGE *message)
 {
        if (!session_context)
        {
@@ -1521,7 +1522,7 @@ pool_check_pending_message_and_reply(POOL_MESSAGE_TYPE type, char kind)
  * pool_pending_message_free_pending_message.
  */
 POOL_PENDING_MESSAGE *
-pool_pending_message_find_lastest_by_query_context(POOL_QUERY_CONTEXT * qc)
+pool_pending_message_find_lastest_by_query_context(POOL_QUERY_CONTEXT *qc)
 {
        List       *msgs;
        POOL_PENDING_MESSAGE *msg;
@@ -1573,7 +1574,7 @@ pool_pending_message_find_lastest_by_query_context(POOL_QUERY_CONTEXT * qc)
  * the pending message is one of primary or standby node.
  */
 int
-pool_pending_message_get_target_backend_id(POOL_PENDING_MESSAGE * msg)
+pool_pending_message_get_target_backend_id(POOL_PENDING_MESSAGE *msg)
 {
        int                     backend_id = -1;
        int                     i;
@@ -1602,8 +1603,8 @@ pool_pending_message_get_message_num_by_backend_id(int backend_id)
 {
        ListCell   *cell;
        ListCell   *next;
-       int        cnt = 0;
-       int        i;
+       int                     cnt = 0;
+       int                     i;
 
        if (!session_context)
        {
@@ -1641,6 +1642,7 @@ pool_pending_message_set_flush_request(void)
        foreach(msg_item, session_context->pending_messages)
        {
                POOL_PENDING_MESSAGE *msg = (POOL_PENDING_MESSAGE *) lfirst(msg_item);
+
                msg->flush_pending = true;
                ereport(DEBUG5,
                                (errmsg("pool_pending_message_set_flush_request: msg: %s",
@@ -1799,10 +1801,10 @@ pool_temp_tables_destroy(void)
  * If the table already exists, just replace state.
  */
 void
-pool_temp_tables_add(char * tablename, POOL_TEMP_TABLE_STATE state)
+pool_temp_tables_add(char *tablename, POOL_TEMP_TABLE_STATE state)
 {
        MemoryContext old_context;
-       POOL_TEMP_TABLE * table;
+       POOL_TEMP_TABLE *table;
 
        if (!session_context)
                ereport(ERROR,
@@ -1832,7 +1834,7 @@ pool_temp_tables_add(char * tablename, POOL_TEMP_TABLE_STATE state)
  */
 
 POOL_TEMP_TABLE *
-pool_temp_tables_find(char * tablename)
+pool_temp_tables_find(char *tablename)
 {
        ListCell   *cell;
 
@@ -1842,7 +1844,8 @@ pool_temp_tables_find(char * tablename)
 
        foreach(cell, session_context->temp_tables)
        {
-               POOL_TEMP_TABLE * table = (POOL_TEMP_TABLE *)lfirst(cell);
+               POOL_TEMP_TABLE *table = (POOL_TEMP_TABLE *) lfirst(cell);
+
                if (strcmp(tablename, table->tablename) == 0)
                        return table;
        }
@@ -1855,9 +1858,9 @@ pool_temp_tables_find(char * tablename)
  * the table state.
  */
 void
-pool_temp_tables_delete(char * tablename, POOL_TEMP_TABLE_STATE state)
+pool_temp_tables_delete(char *tablename, POOL_TEMP_TABLE_STATE state)
 {
-       POOL_TEMP_TABLE * table;
+       POOL_TEMP_TABLE *table;
        MemoryContext old_context;
 
        if (!session_context)
@@ -1914,7 +1917,7 @@ pool_temp_tables_commit_pending(void)
 Retry:
        foreach(cell, session_context->temp_tables)
        {
-               POOL_TEMP_TABLE * table = (POOL_TEMP_TABLE *)lfirst(cell);
+               POOL_TEMP_TABLE *table = (POOL_TEMP_TABLE *) lfirst(cell);
 
                if (table->state == TEMP_TABLE_CREATING)
                {
@@ -1957,7 +1960,7 @@ pool_temp_tables_remove_pending(void)
 Retry:
        foreach(cell, session_context->temp_tables)
        {
-               POOL_TEMP_TABLE * table = (POOL_TEMP_TABLE *)lfirst(cell);
+               POOL_TEMP_TABLE *table = (POOL_TEMP_TABLE *) lfirst(cell);
 
                if (table->state == TEMP_TABLE_CREATING || table->state == TEMP_TABLE_DROPPING)
                {
@@ -1985,7 +1988,8 @@ pool_temp_tables_dump(void)
 
        foreach(cell, session_context->temp_tables)
        {
-               POOL_TEMP_TABLE * table = (POOL_TEMP_TABLE *)lfirst(cell);
+               POOL_TEMP_TABLE *table = (POOL_TEMP_TABLE *) lfirst(cell);
+
                ereport(DEBUG1,
                                (errmsg("pool_temp_tables_dump: table %s state: %d",
                                                table->tablename, table->state)));
index 08a21c8a74ec2b08f4293aa9665ae3bbf832edd4..a5ee9a183d0b68c5c0f9927ce8f4793a5cdafd1e 100644 (file)
 #ifndef pool_auth_h
 #define pool_auth_h
 
-extern void connection_do_auth(POOL_CONNECTION_POOL_SLOT * cp, char *password);
-extern int     pool_do_auth(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend);
-extern int     pool_do_reauth(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * cp);
-extern void authenticate_frontend(POOL_CONNECTION * frontend);
+extern void connection_do_auth(POOL_CONNECTION_POOL_SLOT *cp, char *password);
+extern int     pool_do_auth(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
+extern int     pool_do_reauth(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp);
+extern void authenticate_frontend(POOL_CONNECTION *frontend);
 
 extern void pool_random_salt(char *md5Salt);
 extern void pool_random(void *buf, size_t len);
 
-#endif /* pool_auth_h */
+#endif                                                 /* pool_auth_h */
index a6e0a1533c1debda930d0a7ce2c48beb0af8095c..e92404fd973d80fe3b3f696d1f5679bdc39a965a 100644 (file)
@@ -101,10 +101,11 @@ struct HbaLine
        char       *ldapprefix;
        char       *ldapsuffix;
        /* Additional LDAPl option with pgpool */
-       bool            backend_use_passwd; /* If true, pgpool use same password to auth backend */
+       bool            backend_use_passwd; /* If true, pgpool use same password to
+                                                                        * auth backend */
 };
 
 extern bool load_hba(char *hbapath);
-extern void ClientAuthentication(POOL_CONNECTION * frontend);
+extern void ClientAuthentication(POOL_CONNECTION *frontend);
 
 #endif                                                 /* POOL_HBA_H */
index ace61160c4f53ba2dfc053bd09599153c9954d5b..17b07b456a04683210568f535de4dc5da358be22 100644 (file)
@@ -29,7 +29,8 @@
 
 #define POOL_PASSWD_FILENAME "pool_passwd"
 #define POOL_PASSWD_LEN 35
-#define MAX_POOL_PASSWD_LEN 132 /* In case of TEXT prefix(4byte) and plain text password(128byte)*/
+#define MAX_POOL_PASSWD_LEN 132 /* In case of TEXT prefix(4byte) and plain
+                                                                * text password(128byte) */
 
 #define MAX_USER_NAME_LEN      128
 #define MAX_PGPASS_LEN         128
@@ -47,7 +48,7 @@ typedef enum
                                                                 * pgpool-II child main process */
        POOL_PASSWD_RW,                         /* open pool_passwd in read/write mode. used
                                                                 * by pg_md5 command */
-}                      POOL_PASSWD_MODE;
+} POOL_PASSWD_MODE;
 
 typedef enum PasswordType
 {
@@ -64,16 +65,16 @@ typedef struct UserPassword
        char       *userName;
        char       *password;
        PasswordType passwordType;
-}                      UserPassword;
+} UserPassword;
 
 typedef struct PasswordMapping
 {
        UserPassword pgpoolUser;
        UserPassword backendUser;
        bool            mappedUser;
-}                      PasswordMapping;
+} PasswordMapping;
 
-extern PasswordMapping * pool_get_user_credentials(char *username);
+extern PasswordMapping *pool_get_user_credentials(char *username);
 extern PasswordType get_password_type(const char *shadow_pass);
 extern void pool_init_pool_passwd(char *pool_passwd_filename, POOL_PASSWD_MODE mode);
 extern int     pool_create_passwdent(char *username, char *passwd);
@@ -84,6 +85,6 @@ extern void pool_reopen_passwd_file(void);
 extern char *get_decrypted_password(const char *shadow_pass);
 extern char *read_pool_key(char *key_file_path);
 extern char *get_pgpool_config_user_password(char *username, char *password_in_config);
-extern void delete_passwordMapping(PasswordMapping * pwdMapping);
-extern int check_password_type_is_not_md5(char *username, char *password_in_config);
+extern void delete_passwordMapping(PasswordMapping *pwdMapping);
+extern int     check_password_type_is_not_md5(char *username, char *password_in_config);
 #endif                                                 /* POOL_PASSWD_H */
index 9852f48e69d176ae89f13ef21ddf85d26f98bd00..56ca862c03d73eeb9c62aebdd7cff26a180e0a60 100644 (file)
@@ -82,12 +82,12 @@ extern void scram_HMAC_update(scram_HMAC_ctx *ctx, const char *str, int slen);
 extern void scram_HMAC_final(uint8 *result, scram_HMAC_ctx *ctx);
 
 extern void scram_SaltedPassword(const char *password, const char *salt,
-                                        int saltlen, int iterations, uint8 *result);
+                                                                int saltlen, int iterations, uint8 *result);
 extern void scram_H(const uint8 *str, int len, uint8 *result);
 extern void scram_ClientKey(const uint8 *salted_password, uint8 *result);
 extern void scram_ServerKey(const uint8 *salted_password, uint8 *result);
 
 extern char *scram_build_verifier(const char *salt, int saltlen, int iterations,
-                                        const char *password);
+                                                                 const char *password);
 
 #endif                                                 /* SCRAM_COMMON_H */
index 883ab1442a2693701d7607c7149856247a01f037..2eaf0c06cce9a6581a37087f9148879728249bc8 100644 (file)
 
 /* Routines dedicated to authentication */
 extern void *pg_be_scram_init(const char *username, const char *shadow_pass);
-extern int pg_be_scram_exchange(void *opaq, char *input, int inputlen,
-                                        char **output, int *outputlen, char **logdetail);
+extern int     pg_be_scram_exchange(void *opaq, char *input, int inputlen,
+                                                                char **output, int *outputlen, char **logdetail);
 
 /* Routines to handle and check SCRAM-SHA-256 verifier */
 extern char *pg_be_scram_build_verifier(const char *password);
 extern bool scram_verify_plain_password(const char *username,
-                                                       const char *password, const char *verifier);
+                                                                               const char *password, const char *verifier);
 extern void *pg_fe_scram_init(const char *username, const char *password);
 extern void pg_fe_scram_exchange(void *opaq, char *input, int inputlen,
-                                        char **output, int *outputlen,
-                                        bool *done, bool *success);
+                                                                char **output, int *outputlen,
+                                                                bool *done, bool *success);
 extern void pg_fe_scram_free(void *opaq);
 extern char *pg_fe_scram_build_verifier(const char *password);
 
index a9f9e1002576f391dfa12b4b4d7c55b2782ce63e..194b6220ac25babdf0b41750176575067e3f39b3 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef POOL_PROCESS_CONTEXT_H
 #define POOL_PROCESS_CONTEXT_H
 
-//#include "pool.h"
+/* #include "pool.h" */
 #include "pcp/libpcp_ext.h"
 #include "utils/pool_signal.h"
 
@@ -57,22 +57,22 @@ typedef struct
        unsigned int last_alarm_second;
        unsigned int undo_alarm_second;
 
-}                      POOL_PROCESS_CONTEXT;
+} POOL_PROCESS_CONTEXT;
 
 extern void pool_init_process_context(void);
-extern POOL_PROCESS_CONTEXT * pool_get_process_context(void);
-extern ProcessInfo * pool_get_my_process_info(void);
+extern POOL_PROCESS_CONTEXT *pool_get_process_context(void);
+extern ProcessInfo *pool_get_my_process_info(void);
 extern void pool_increment_local_session_id(void);
-extern size_t  pool_coninfo_size(void);
+extern size_t pool_coninfo_size(void);
 extern int     pool_coninfo_num(void);
-extern ConnectionInfo * pool_coninfo(int child, int connection_pool, int backend);
-extern ConnectionInfo * pool_coninfo_pid(int pid, int connection_pool, int backend);
+extern ConnectionInfo *pool_coninfo(int child, int connection_pool, int backend);
+extern ConnectionInfo *pool_coninfo_pid(int pid, int connection_pool, int backend);
 extern void pool_coninfo_set_frontend_connected(int proc_id, int pool_index);
 extern void pool_coninfo_unset_frontend_connected(int proc_id, int pool_index);
 
-extern ConnectionInfo * pool_coninfo_backend_pid(int backend_pid, int *backend_node_id);
-extern void pool_set_connection_will_be_terminated(ConnectionInfo * connInfo);
-extern void pool_unset_connection_will_be_terminated(ConnectionInfo * connInfo);
+extern ConnectionInfo *pool_coninfo_backend_pid(int backend_pid, int *backend_node_id);
+extern void pool_set_connection_will_be_terminated(ConnectionInfo *connInfo);
+extern void pool_unset_connection_will_be_terminated(ConnectionInfo *connInfo);
 
 extern void pool_alarm(pool_sighandler_t handler, unsigned int second);
 extern void pool_undo_alarm(void);
index 8ca7fb33637f289232de68be492c2002029b66ee..1d1ef13eb9d6ee2de2e5ede6df765746e5d0eb02 100644 (file)
@@ -44,7 +44,7 @@ typedef enum
        POOL_PARSE_COMPLETE,
        POOL_BIND_COMPLETE,
        POOL_EXECUTE_COMPLETE
-}                      POOL_QUERY_STATE;
+} POOL_QUERY_STATE;
 
 /*
  * Query context:
@@ -62,8 +62,8 @@ typedef struct
        Node       *rewritten_parse_tree;       /* rewritten raw parser output if any */
        bool            where_to_send[MAX_NUM_BACKENDS];        /* DB node map to send
                                                                                                         * query */
-       int         load_balance_node_id;       /* load balance node id per statement */
-       int                     virtual_main_node_id; /* the 1st DB node to send query */
+       int                     load_balance_node_id;   /* load balance node id per statement */
+       int                     virtual_main_node_id;   /* the 1st DB node to send query */
        POOL_QUERY_STATE query_state[MAX_NUM_BACKENDS]; /* for extended query
                                                                                                         * protocol */
        bool            is_cache_safe;  /* true if SELECT is safe to cache */
@@ -90,39 +90,39 @@ typedef struct
                                                                         * extended query, do not commit cache if
                                                                         * this flag is true. */
 
-       bool            atEnd;                          /* if true all rows have been already
-                                                                        * fetched from the portal */
+       bool            atEnd;                  /* if true all rows have been already fetched
+                                                                * from the portal */
 
-       bool            partial_fetch;          /* if true some rows have been fetched by
-                                                                        * an execute with non 0 row option */
+       bool            partial_fetch;  /* if true some rows have been fetched by an
+                                                                * execute with non 0 row option */
 
        MemoryContext memory_context;   /* memory context for query context */
-}                      POOL_QUERY_CONTEXT;
+} POOL_QUERY_CONTEXT;
 
-extern POOL_QUERY_CONTEXT * pool_init_query_context(void);
-extern void pool_query_context_destroy(POOL_QUERY_CONTEXT * query_context);
-extern POOL_QUERY_CONTEXT * pool_query_context_shallow_copy(POOL_QUERY_CONTEXT * query_context);
-extern void pool_start_query(POOL_QUERY_CONTEXT * query_context, char *query, int len, Node *node);
-extern void pool_set_node_to_be_sent(POOL_QUERY_CONTEXT * query_context, int node_id);
-extern bool pool_is_node_to_be_sent(POOL_QUERY_CONTEXT * query_context, int node_id);
-extern void pool_set_node_to_be_sent(POOL_QUERY_CONTEXT * query_context, int node_id);
-extern void pool_unset_node_to_be_sent(POOL_QUERY_CONTEXT * query_context, int node_id);
-extern void pool_clear_node_to_be_sent(POOL_QUERY_CONTEXT * query_context);
-extern void pool_setall_node_to_be_sent(POOL_QUERY_CONTEXT * query_context);
-extern bool pool_multi_node_to_be_sent(POOL_QUERY_CONTEXT * query_context);
-extern void pool_where_to_send(POOL_QUERY_CONTEXT * query_context, char *query, Node *node);
-extern POOL_STATUS pool_send_and_wait(POOL_QUERY_CONTEXT * query_context, int send_type, int node_id);
-extern POOL_STATUS pool_extended_send_and_wait(POOL_QUERY_CONTEXT * query_context, char *kind, int len, char *contents, int send_type, int node_id, bool nowait);
+extern POOL_QUERY_CONTEXT *pool_init_query_context(void);
+extern void pool_query_context_destroy(POOL_QUERY_CONTEXT *query_context);
+extern POOL_QUERY_CONTEXT *pool_query_context_shallow_copy(POOL_QUERY_CONTEXT *query_context);
+extern void pool_start_query(POOL_QUERY_CONTEXT *query_context, char *query, int len, Node *node);
+extern void pool_set_node_to_be_sent(POOL_QUERY_CONTEXT *query_context, int node_id);
+extern bool pool_is_node_to_be_sent(POOL_QUERY_CONTEXT *query_context, int node_id);
+extern void pool_set_node_to_be_sent(POOL_QUERY_CONTEXT *query_context, int node_id);
+extern void pool_unset_node_to_be_sent(POOL_QUERY_CONTEXT *query_context, int node_id);
+extern void pool_clear_node_to_be_sent(POOL_QUERY_CONTEXT *query_context);
+extern void pool_setall_node_to_be_sent(POOL_QUERY_CONTEXT *query_context);
+extern bool pool_multi_node_to_be_sent(POOL_QUERY_CONTEXT *query_context);
+extern void pool_where_to_send(POOL_QUERY_CONTEXT *query_context, char *query, Node *node);
+extern POOL_STATUS pool_send_and_wait(POOL_QUERY_CONTEXT *query_context, int send_type, int node_id);
+extern POOL_STATUS pool_extended_send_and_wait(POOL_QUERY_CONTEXT *query_context, char *kind, int len, char *contents, int send_type, int node_id, bool nowait);
 extern Node *pool_get_parse_tree(void);
 extern char *pool_get_query_string(void);
 extern bool is_set_transaction_serializable(Node *node);
 extern bool is_start_transaction_query(Node *node);
 extern bool is_read_write(TransactionStmt *node);
 extern bool is_serializable(TransactionStmt *node);
-extern bool pool_need_to_treat_as_if_default_transaction(POOL_QUERY_CONTEXT * query_context);
+extern bool pool_need_to_treat_as_if_default_transaction(POOL_QUERY_CONTEXT *query_context);
 extern bool is_savepoint_query(Node *node);
 extern bool is_2pc_transaction_query(Node *node);
-extern void pool_set_query_state(POOL_QUERY_CONTEXT * query_context, POOL_QUERY_STATE state);
+extern void pool_set_query_state(POOL_QUERY_CONTEXT *query_context, POOL_QUERY_STATE state);
 extern int     statecmp(POOL_QUERY_STATE s1, POOL_QUERY_STATE s2);
 extern bool pool_is_cache_safe(void);
 extern void pool_set_cache_safe(void);
@@ -131,8 +131,8 @@ extern bool pool_is_cache_exceeded(void);
 extern void pool_set_cache_exceeded(void);
 extern void pool_unset_cache_exceeded(void);
 extern bool pool_is_transaction_read_only(Node *node);
-extern void pool_force_query_node_to_backend(POOL_QUERY_CONTEXT * query_context, int backend_id);
+extern void pool_force_query_node_to_backend(POOL_QUERY_CONTEXT *query_context, int backend_id);
 extern void check_object_relationship_list(char *name, bool is_func_name);
-extern int wait_for_failover_to_finish(void);
+extern int     wait_for_failover_to_finish(void);
 
 #endif                                                 /* POOL_QUERY_CONTEXT_H */
index a662aa01cf8409c39e5c5cba7b510117447c7931..e86966e2e92eec9b093668626d5622f9fd1ff5c5 100644 (file)
@@ -43,7 +43,7 @@ typedef enum
        POOL_READ_COMMITTED,            /* Read committed */
        POOL_REPEATABLE_READ,           /* Repeatable read */
        POOL_SERIALIZABLE                       /* Serializable */
-}                      POOL_TRANSACTION_ISOLATION;
+} POOL_TRANSACTION_ISOLATION;
 
 /*
  * Return values for pool_use_sync_map
@@ -63,7 +63,7 @@ typedef enum
        POOL_SENT_MESSAGE_CREATED,      /* initial state of sent message */
        POOL_SENT_MESSAGE_CLOSED        /* sent message closed but close complete
                                                                 * message has not arrived yet */
-}                      POOL_SENT_MESSAGE_STATE;
+} POOL_SENT_MESSAGE_STATE;
 
 /*
  * Message content of extended query
@@ -90,7 +90,7 @@ typedef struct
        int                     param_offset;   /* Offset from contents where actual bind
                                                                 * parameters are stored. This is meaningful
                                                                 * only when is_cache_safe is true. */
-}                      POOL_SENT_MESSAGE;
+} POOL_SENT_MESSAGE;
 
 /*
  * List of POOL_SENT_MESSAGE (XXX this should have been implemented using a
@@ -101,7 +101,7 @@ typedef struct
        int                     capacity;               /* capacity of list */
        int                     size;                   /* number of elements */
        POOL_SENT_MESSAGE **sent_messages;
-}                      POOL_SENT_MESSAGE_LIST;
+} POOL_SENT_MESSAGE_LIST;
 
 /*
  * Received message queue used in extended query/streaming replication mode.
@@ -123,7 +123,7 @@ typedef enum
        POOL_DESCRIBE,
        POOL_CLOSE,
        POOL_SYNC
-}                      POOL_MESSAGE_TYPE;
+} POOL_MESSAGE_TYPE;
 
 typedef struct
 {
@@ -140,29 +140,35 @@ typedef struct
        bool            not_forward_to_frontend;        /* Do not forward response from
                                                                                         * backend to frontend. This is
                                                                                         * used by parse_before_bind() */
-       bool            node_ids[MAX_NUM_BACKENDS];     /* backend node map which this message was sent to */
+       bool            node_ids[MAX_NUM_BACKENDS]; /* backend node map which this
+                                                                                        * message was sent to */
        POOL_QUERY_CONTEXT *query_context;      /* query context */
+
        /*
         * If "flush" message arrives, this flag is set to true until all buffered
         * message for frontend are sent out.
         */
        bool            flush_pending;
 
-       bool            is_tx_started_by_multi_statement; /* true if an explicit transaction has been started by
-                                                                                                        multi statement query */
-}                      POOL_PENDING_MESSAGE;
+       bool            is_tx_started_by_multi_statement;       /* true if an explicit
+                                                                                                        * transaction has been
+                                                                                                        * started by multi
+                                                                                                        * statement query */
+} POOL_PENDING_MESSAGE;
 
-typedef enum {
-       TEMP_TABLE_CREATING = 1,                /* temp table creating, not committed yet. */
-       TEMP_TABLE_DROPPING,                    /* temp table dropping, not committed yet. */
-       TEMP_TABLE_CREATE_COMMITTED,            /* temp table created and committed. */
-       TEMP_TABLE_DROP_COMMITTED,              /* temp table dropped and committed. */
-}              POOL_TEMP_TABLE_STATE;
+typedef enum
+{
+       TEMP_TABLE_CREATING = 1,        /* temp table creating, not committed yet. */
+       TEMP_TABLE_DROPPING,            /* temp table dropping, not committed yet. */
+       TEMP_TABLE_CREATE_COMMITTED,    /* temp table created and committed. */
+       TEMP_TABLE_DROP_COMMITTED,      /* temp table dropped and committed. */
+} POOL_TEMP_TABLE_STATE;
 
-typedef struct {
+typedef struct
+{
        char            tablename[MAX_IDENTIFIER_LEN];  /* temporary table name */
-       POOL_TEMP_TABLE_STATE   state;  /* see above */
-}                      POOL_TEMP_TABLE;
+       POOL_TEMP_TABLE_STATE state;    /* see above */
+} POOL_TEMP_TABLE;
 
 
 typedef enum
@@ -306,7 +312,10 @@ typedef struct
        int                     preferred_main_node_id;
 #endif
 
-       /* Whether snapshot is acquired in this transaction. Only used by Snapshot Isolation mode. */
+       /*
+        * Whether snapshot is acquired in this transaction. Only used by Snapshot
+        * Isolation mode.
+        */
        SI_STATE        si_state;
        /* Whether transaction is read only. Only used by Snapshot Isolation mode. */
        SI_STATE        transaction_read_only;
@@ -321,22 +330,24 @@ typedef struct
                                                                                                         * transaction has been
                                                                                                         * started by a
                                                                                                         * multi-statement-query */
+
        /*
-        * True if query cache feature disabled until session ends.
-        * This is set when SET ROLE/SET SESSION AUTHORIZATION executed.
+        * True if query cache feature disabled until session ends. This is set
+        * when SET ROLE/SET SESSION AUTHORIZATION executed.
         */
-       bool    query_cache_disabled;
+       bool            query_cache_disabled;
+
        /*
         * True if query cache feature disabled until current transaction ends.
         * This is set when REVOKE executed in a transaction.
         */
-       bool    query_cache_disabled_tx;
+       bool            query_cache_disabled_tx;
 
-}                      POOL_SESSION_CONTEXT;
+} POOL_SESSION_CONTEXT;
 
-extern void pool_init_session_context(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend);
+extern void pool_init_session_context(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
 extern void pool_session_context_destroy(void);
-extern POOL_SESSION_CONTEXT * pool_get_session_context(bool noerror);
+extern POOL_SESSION_CONTEXT *pool_get_session_context(bool noerror);
 extern int     pool_get_local_session_id(void);
 extern bool pool_is_query_in_progress(void);
 extern void pool_set_query_in_progress(void);
@@ -350,18 +361,18 @@ extern void pool_unset_doing_extended_query_message(void);
 extern bool pool_is_ignore_till_sync(void);
 extern void pool_set_ignore_till_sync(void);
 extern void pool_unset_ignore_till_sync(void);
-extern POOL_SENT_MESSAGE * pool_create_sent_message(char kind, int len, char *contents,
-                                                                                                       int num_tsparams, const char *name,
-                                                                                                       POOL_QUERY_CONTEXT * query_context);
-extern void pool_add_sent_message(POOL_SENT_MESSAGE * message);
+extern POOL_SENT_MESSAGE *pool_create_sent_message(char kind, int len, char *contents,
+                                                                                                  int num_tsparams, const char *name,
+                                                                                                  POOL_QUERY_CONTEXT *query_context);
+extern void pool_add_sent_message(POOL_SENT_MESSAGE *message);
 extern bool pool_remove_sent_message(char kind, const char *name);
 extern void pool_remove_sent_messages(char kind);
 extern void pool_clear_sent_message_list(void);
-extern void pool_sent_message_destroy(POOL_SENT_MESSAGE * message);
-extern POOL_SENT_MESSAGE * pool_get_sent_message(char kind, const char *name, POOL_SENT_MESSAGE_STATE state);
-extern void pool_set_sent_message_state(POOL_SENT_MESSAGE * message);
+extern void pool_sent_message_destroy(POOL_SENT_MESSAGE *message);
+extern POOL_SENT_MESSAGE *pool_get_sent_message(char kind, const char *name, POOL_SENT_MESSAGE_STATE state);
+extern void pool_set_sent_message_state(POOL_SENT_MESSAGE *message);
 extern void pool_zap_query_context_in_sent_messages(POOL_QUERY_CONTEXT *query_context);
-extern POOL_SENT_MESSAGE * pool_get_sent_message_by_query_context(POOL_QUERY_CONTEXT * query_context);
+extern POOL_SENT_MESSAGE *pool_get_sent_message_by_query_context(POOL_QUERY_CONTEXT *query_context);
 extern void pool_unset_writing_transaction(void);
 extern void pool_set_writing_transaction(void);
 extern bool pool_is_writing_transaction(void);
@@ -375,28 +386,28 @@ extern void pool_unset_command_success(void);
 extern void pool_set_command_success(void);
 extern bool pool_is_command_success(void);
 extern void pool_copy_prep_where(bool *src, bool *dest);
-extern bool can_query_context_destroy(POOL_QUERY_CONTEXT * qc);
+extern bool can_query_context_destroy(POOL_QUERY_CONTEXT *qc);
 extern void pool_pending_messages_init(void);
 extern void pool_pending_messages_destroy(void);
-extern POOL_PENDING_MESSAGE * pool_pending_message_create(char kind, int len, char *contents);
-extern void pool_pending_message_free_pending_message(POOL_PENDING_MESSAGE * message);
-extern void pool_pending_message_dest_set(POOL_PENDING_MESSAGE * message, POOL_QUERY_CONTEXT * query_context);
-extern void pool_pending_message_query_context_dest_set(POOL_PENDING_MESSAGE * message, POOL_QUERY_CONTEXT * query_context);
-extern void pool_pending_message_query_set(POOL_PENDING_MESSAGE * message, POOL_QUERY_CONTEXT * query_context);
-extern void pool_pending_message_add(POOL_PENDING_MESSAGE * message);
-extern POOL_PENDING_MESSAGE * pool_pending_message_head_message(void);
-extern POOL_PENDING_MESSAGE * pool_pending_message_pull_out(void);
-extern POOL_PENDING_MESSAGE * pool_pending_message_get(POOL_MESSAGE_TYPE type);
-extern char pool_get_close_message_spec(POOL_PENDING_MESSAGE * msg);
-extern char *pool_get_close_message_name(POOL_PENDING_MESSAGE * msg);
+extern POOL_PENDING_MESSAGE *pool_pending_message_create(char kind, int len, char *contents);
+extern void pool_pending_message_free_pending_message(POOL_PENDING_MESSAGE *message);
+extern void pool_pending_message_dest_set(POOL_PENDING_MESSAGE *message, POOL_QUERY_CONTEXT *query_context);
+extern void pool_pending_message_query_context_dest_set(POOL_PENDING_MESSAGE *message, POOL_QUERY_CONTEXT *query_context);
+extern void pool_pending_message_query_set(POOL_PENDING_MESSAGE *message, POOL_QUERY_CONTEXT *query_context);
+extern void pool_pending_message_add(POOL_PENDING_MESSAGE *message);
+extern POOL_PENDING_MESSAGE *pool_pending_message_head_message(void);
+extern POOL_PENDING_MESSAGE *pool_pending_message_pull_out(void);
+extern POOL_PENDING_MESSAGE *pool_pending_message_get(POOL_MESSAGE_TYPE type);
+extern char pool_get_close_message_spec(POOL_PENDING_MESSAGE *msg);
+extern char *pool_get_close_message_name(POOL_PENDING_MESSAGE *msg);
 extern void pool_pending_message_reset_previous_message(void);
-extern void pool_pending_message_set_previous_message(POOL_PENDING_MESSAGE * message);
-extern POOL_PENDING_MESSAGE * pool_pending_message_get_previous_message(void);
+extern void pool_pending_message_set_previous_message(POOL_PENDING_MESSAGE *message);
+extern POOL_PENDING_MESSAGE *pool_pending_message_get_previous_message(void);
 extern bool pool_pending_message_exists(void);
 extern const char *pool_pending_message_type_to_string(POOL_MESSAGE_TYPE type);
 extern void pool_check_pending_message_and_reply(POOL_MESSAGE_TYPE type, char kind);
-extern POOL_PENDING_MESSAGE * pool_pending_message_find_lastest_by_query_context(POOL_QUERY_CONTEXT * qc);
-extern int     pool_pending_message_get_target_backend_id(POOL_PENDING_MESSAGE * msg);
+extern POOL_PENDING_MESSAGE *pool_pending_message_find_lastest_by_query_context(POOL_QUERY_CONTEXT *qc);
+extern int     pool_pending_message_get_target_backend_id(POOL_PENDING_MESSAGE *msg);
 extern int     pool_pending_message_get_message_num_by_backend_id(int backend_id);
 extern void pool_pending_message_set_flush_request(void);
 extern void dump_pending_message(void);
@@ -409,12 +420,12 @@ extern void pool_unset_suspend_reading_from_frontend(void);
 
 extern void pool_temp_tables_init(void);
 extern void pool_temp_tables_destroy(void);
-extern void    pool_temp_tables_add(char * tablename, POOL_TEMP_TABLE_STATE state);
-extern POOL_TEMP_TABLE * pool_temp_tables_find(char * tablename);
-extern void pool_temp_tables_delete(char * tablename, POOL_TEMP_TABLE_STATE state);
-extern void    pool_temp_tables_commit_pending(void);
-extern void    pool_temp_tables_remove_pending(void);
-extern void    pool_temp_tables_dump(void);
+extern void pool_temp_tables_add(char *tablename, POOL_TEMP_TABLE_STATE state);
+extern POOL_TEMP_TABLE *pool_temp_tables_find(char *tablename);
+extern void pool_temp_tables_delete(char *tablename, POOL_TEMP_TABLE_STATE state);
+extern void pool_temp_tables_commit_pending(void);
+extern void pool_temp_tables_remove_pending(void);
+extern void pool_temp_tables_dump(void);
 
 extern bool is_tx_started_by_multi_statement_query(void);
 extern void set_tx_started_by_multi_statement_query(void);
index ad26f2f0a460680518c33d3deca8e75172763966..29f59b7fd462692aecd99706466a8017443f57d7 100644 (file)
 /*
  * Health check statistics per node
 */
-typedef struct {
-       uint64  total_count;    /* total count of health check */
-       uint64  success_count;  /* total count of successful health check */
-       uint64  fail_count;             /* total count of failed health check */
-       uint64  skip_count;             /* total count of skipped health check */
-       uint64  retry_count;    /* total count of health check retries */
-       uint32  max_retry_count;        /* max retry count in a health check session */
-       uint64  total_health_check_duration;    /* sum of health check duration */
-       int32   max_health_check_duration;      /* maximum duration spent for a health check session in milli seconds */
-       int32   min_health_check_duration;      /* minimum duration spent for a health check session in milli seconds */
-       time_t  last_health_check;      /* last health check timestamp */
-       time_t  last_successful_health_check;   /* last successful health check timestamp */
-       time_t  last_skip_health_check;                 /* last skipped health check timestamp */
-       time_t  last_failed_health_check;               /* last failed health check timestamp */
+typedef struct
+{
+       uint64          total_count;    /* total count of health check */
+       uint64          success_count;  /* total count of successful health check */
+       uint64          fail_count;             /* total count of failed health check */
+       uint64          skip_count;             /* total count of skipped health check */
+       uint64          retry_count;    /* total count of health check retries */
+       uint32          max_retry_count;        /* max retry count in a health check
+                                                                        * session */
+       uint64          total_health_check_duration;    /* sum of health check
+                                                                                                * duration */
+       int32           max_health_check_duration;      /* maximum duration spent for a
+                                                                                        * health check session in milli
+                                                                                        * seconds */
+       int32           min_health_check_duration;      /* minimum duration spent for a
+                                                                                        * health check session in milli
+                                                                                        * seconds */
+       time_t          last_health_check;      /* last health check timestamp */
+       time_t          last_successful_health_check;   /* last successful health
+                                                                                                * check timestamp */
+       time_t          last_skip_health_check; /* last skipped health check timestamp */
+       time_t          last_failed_health_check;       /* last failed health check
+                                                                                        * timestamp */
 } POOL_HEALTH_CHECK_STATISTICS;
 
-extern volatile POOL_HEALTH_CHECK_STATISTICS   *health_check_stats;    /* health check stats area in shared memory */
+extern volatile POOL_HEALTH_CHECK_STATISTICS *health_check_stats;      /* health check stats
+                                                                                                                                        * area in shared memory */
 
 extern void do_health_check_child(int *node_id);
-extern size_t  health_check_stats_shared_memory_size(void);
-extern void            health_check_stats_init(POOL_HEALTH_CHECK_STATISTICS *addr);
+extern size_t health_check_stats_shared_memory_size(void);
+extern void health_check_stats_init(POOL_HEALTH_CHECK_STATISTICS *addr);
 
-#endif /* health_check_h */
+#endif                                                 /* health_check_h */
index 0b2fc089c346ba20e91e97ec3cf4217f49925b3f..82adbd2e1d398c87df2f035a9b059509dfce8d1b 100644 (file)
@@ -67,7 +67,7 @@ typedef struct
        int32           pid;                    /* writer's pid */
        char            is_last;                /* last chunk of message? 't' or 'f' ('T' or
                                                                 * 'F' for CSV case) */
-       char            data[]; /* data payload starts here */
+       char            data[];                 /* data payload starts here */
 } PipeProtoHeader;
 
 typedef union
index 6b4dc60d86c689e7b47640423ff7f6268521eae5..b20b85d6f0706c315c9d7f331aa7a4b50d610b82 100644 (file)
@@ -42,4 +42,4 @@ extern void register_backend_state_sync_req_interrupt(void);
 extern void register_inform_quarantine_nodes_req(void);
 extern bool register_node_operation_request(POOL_REQUEST_KIND kind,
                                                                                        int *node_id_set, int count, unsigned char flags);
-#endif /* pool_internal_comms_h */
+#endif                                                 /* pool_internal_comms_h */
index 1a44ae21615f75da4d2a6908fb473f3253a83464..b2255b01e82620239f21699aca8cae8a4da3772f 100644 (file)
@@ -19,7 +19,7 @@ typedef enum ExplainFormat
        EXPLAIN_FORMAT_XML,
        EXPLAIN_FORMAT_JSON,
        EXPLAIN_FORMAT_YAML
-} ExplainFormat;
+}                      ExplainFormat;
 
 typedef struct ExplainState
 {
@@ -41,12 +41,12 @@ typedef struct ExplainState
        List       *rtable_names;       /* alias names for RTEs */
        List       *deparse_cxt;        /* context list for deparsing expressions */
        Bitmapset  *printed_subplans;   /* ids of SubPlans we've printed */
-} ExplainState;
+}                      ExplainState;
 
 /* Hook for plugins to get control in ExplainOneQuery() */
 typedef void (*ExplainOneQuery_hook_type) (Query *query,
                                                                                   IntoClause *into,
-                                                                                  ExplainState *es,
+                                                                                  ExplainState * es,
                                                                                   const char *queryString,
                                                                                   ParamListInfo params);
 extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
@@ -57,42 +57,42 @@ extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;
 
 
 extern void ExplainQuery(ExplainStmt *stmt, const char *queryString,
-                        ParamListInfo params, DestReceiver *dest);
+                                                ParamListInfo params, DestReceiver * dest);
 
-extern ExplainState *NewExplainState(void);
+extern ExplainState * NewExplainState(void);
 
 extern TupleDesc ExplainResultDesc(ExplainStmt *stmt);
 
 extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,
-                                 ExplainState *es,
-                                 const char *queryString, ParamListInfo params);
+                                                         ExplainState * es,
+                                                         const char *queryString, ParamListInfo params);
 
-extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,
-                          ExplainState *es, const char *queryString,
-                          ParamListInfo params, const instr_time *planduration);
+extern void ExplainOnePlan(PlannedStmt * plannedstmt, IntoClause *into,
+                                                  ExplainState * es, const char *queryString,
+                                                  ParamListInfo params, const instr_time * planduration);
 
-extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
-extern void ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc);
+extern void ExplainPrintPlan(ExplainState * es, QueryDesc * queryDesc);
+extern void ExplainPrintTriggers(ExplainState * es, QueryDesc * queryDesc);
 
-extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc);
+extern void ExplainQueryText(ExplainState * es, QueryDesc * queryDesc);
 
-extern void ExplainBeginOutput(ExplainState *es);
-extern void ExplainEndOutput(ExplainState *es);
-extern void ExplainSeparatePlans(ExplainState *es);
+extern void ExplainBeginOutput(ExplainState * es);
+extern void ExplainEndOutput(ExplainState * es);
+extern void ExplainSeparatePlans(ExplainState * es);
 
 extern void ExplainPropertyList(const char *qlabel, List *data,
-                                       ExplainState *es);
+                                                               ExplainState * es);
 extern void ExplainPropertyListNested(const char *qlabel, List *data,
-                                                 ExplainState *es);
+                                                                         ExplainState * es);
 extern void ExplainPropertyText(const char *qlabel, const char *value,
-                                       ExplainState *es);
+                                                               ExplainState * es);
 extern void ExplainPropertyInteger(const char *qlabel, int value,
-                                          ExplainState *es);
+                                                                  ExplainState * es);
 extern void ExplainPropertyLong(const char *qlabel, long value,
-                                       ExplainState *es);
+                                                               ExplainState * es);
 extern void ExplainPropertyFloat(const char *qlabel, double value, int ndigits,
-                                        ExplainState *es);
+                                                                ExplainState * es);
 extern void ExplainPropertyBool(const char *qlabel, bool value,
-                                       ExplainState *es);
+                                                               ExplainState * es);
 
 #endif                                                 /* EXPLAIN_H */
index b11b0a58ee0ccd238c4d9e81c5a9eb2a6acf5075..03089137eeb4d921461aa15df8bc191e1a830106 100644 (file)
@@ -27,7 +27,7 @@ typedef struct ExtensibleNode
 {
        NodeTag         type;
        const char *extnodename;        /* identifier of ExtensibleNodeMethods */
-} ExtensibleNode;
+}                      ExtensibleNode;
 
 /*
  * node_size is the size of an extensible node of this type in bytes.
@@ -62,11 +62,11 @@ typedef struct ExtensibleNodeMethods
        void            (*nodeOut) (struct StringInfoData *str,
                                                        const struct ExtensibleNode *node);
        void            (*nodeRead) (struct ExtensibleNode *node);
-} ExtensibleNodeMethods;
+}                      ExtensibleNodeMethods;
 
-extern void RegisterExtensibleNodeMethods(const ExtensibleNodeMethods *method);
+extern void RegisterExtensibleNodeMethods(const ExtensibleNodeMethods * method);
 extern const ExtensibleNodeMethods *GetExtensibleNodeMethods(const char *name,
-                                                bool missing_ok);
+                                                                                                                        bool missing_ok);
 
 /*
  * Flags for custom paths, indicating what capabilities the resulting scan
index db644c2781042acc3a551e01e35ebfcdcb63dffd..9571a5ee3a382e1a12bebd3e1f23589ead6b0a72 100644 (file)
@@ -69,10 +69,10 @@ typedef struct base_yy_extra_type
 
 
 /* from parser.c */
-extern int     base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp,
-                                          core_yyscan_t yyscanner);
-extern int     minimal_base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp,
+extern int     base_yylex(YYSTYPE *lvalp, YYLTYPE * llocp,
                                           core_yyscan_t yyscanner);
+extern int     minimal_base_yylex(YYSTYPE *lvalp, YYLTYPE * llocp,
+                                                          core_yyscan_t yyscanner);
 
 /* from gram.y */
 extern void parser_init(base_yy_extra_type *yyext);
index 1d5bb3ed627a6b20a7f8c54641cbb99fa88b48ef..d0d4f3ccebcdfd7696c1e1b5d70226eef6286a76 100644 (file)
@@ -32,9 +32,9 @@ typedef enum NodeTag
        T_Invalid = 0,
 
        /* pgpool Extension */
-                               T_PgpoolVariableSetStmt,
-                               T_PgpoolVariableShowStmt,
-                               T_PgpoolQueryCacheStmt,
+       T_PgpoolVariableSetStmt,
+       T_PgpoolVariableShowStmt,
+       T_PgpoolQueryCacheStmt,
 #include "nodetags.h"
 } NodeTag;
 
@@ -201,7 +201,7 @@ extern void outToken(struct StringInfoData *str, const char *s);
 extern void outBitmapset(struct StringInfoData *str,
                                                 const struct Bitmapset *bms);
 extern void outDatum(struct StringInfoData *str, uintptr_t value,
-                     int typlen, bool typbyval);
+                                        int typlen, bool typbyval);
 extern char *nodeToString(const void *obj);
 extern char *nodeToStringWithLocations(const void *obj);
 extern char *bmsToString(const struct Bitmapset *bms);
@@ -362,7 +362,7 @@ typedef enum AggStrategy
        AGG_SORTED,                                     /* grouped agg, input must be sorted */
        AGG_HASHED,                                     /* grouped agg, use internal hashtable */
        AGG_MIXED,                                      /* grouped agg, hash and sort both used */
-} AggStrategy;
+}                      AggStrategy;
 
 /*
  * AggSplit -
@@ -406,13 +406,13 @@ typedef enum SetOpCmd
        SETOPCMD_INTERSECT_ALL,
        SETOPCMD_EXCEPT,
        SETOPCMD_EXCEPT_ALL,
-} SetOpCmd;
+}                      SetOpCmd;
 
 typedef enum SetOpStrategy
 {
        SETOP_SORTED,                           /* input must be sorted */
        SETOP_HASHED,                           /* use internal hashtable */
-} SetOpStrategy;
+}                      SetOpStrategy;
 
 /*
  * OnConflictAction -
index 1593bad655dd4064c68d3ca2b0cba6c6b13fa90f..cf0ee5bcda248f7131bab5283e7d82ff2fd8885b 100644 (file)
@@ -916,7 +916,7 @@ typedef struct PartitionBoundSpec
        List       *lowerdatums;        /* List of PartitionRangeDatums */
        List       *upperdatums;        /* List of PartitionRangeDatums */
 
-       ParseLoc    location;           /* token location, or -1 if unknown */
+       ParseLoc        location;               /* token location, or -1 if unknown */
 } PartitionBoundSpec;
 
 /*
@@ -950,7 +950,7 @@ typedef struct PartitionRangeDatum
 typedef struct SinglePartitionSpec
 {
        NodeTag         type;
-}                      SinglePartitionSpec;
+} SinglePartitionSpec;
 
 /*
  * PartitionCmd - info for ALTER TABLE/INDEX ATTACH/DETACH PARTITION commands
@@ -1299,7 +1299,7 @@ typedef struct RTEPermissionInfo
        Bitmapset  *selectedCols;       /* columns needing SELECT permission */
        Bitmapset  *insertedCols;       /* columns needing INSERT permission */
        Bitmapset  *updatedCols;        /* columns needing UPDATE permission */
-} RTEPermissionInfo;
+}                      RTEPermissionInfo;
 
 /*
  * RangeTblFunction -
@@ -2498,7 +2498,7 @@ typedef struct GrantStmt
        NodeTag         type;
        bool            is_grant;               /* true = GRANT, false = REVOKE */
        GrantTargetType targtype;       /* type of the grant target */
-       ObjectType  objtype;        /* kind of object being operated on */
+       ObjectType      objtype;                /* kind of object being operated on */
        List       *objects;            /* list of RangeVar nodes, ObjectWithArgs
                                                                 * nodes, or plain names (as String values) */
        List       *privileges;         /* list of AccessPriv nodes */
@@ -3491,7 +3491,7 @@ typedef struct InlineCodeBlock
        Oid                     langOid;                /* OID of selected language */
        bool            langIsTrusted;  /* trusted property of the language */
        bool            atomic;                 /* atomic execution context */
-} InlineCodeBlock;
+}                      InlineCodeBlock;
 
 /* ----------------------
  *             CALL statement
@@ -3521,7 +3521,7 @@ typedef struct CallContext
 
        NodeTag         type;
        bool            atomic;
-} CallContext;
+}                      CallContext;
 
 /* ----------------------
  *             Alter Object Rename Statement
index 9e9384d867ae275e0507a930c1b5344144f6991b..e412c438e4f77d6476935d546e812a94f9a5609a 100644 (file)
@@ -77,5 +77,5 @@ extern Node *makeIntConst(int val, int location);
 
 extern List *get_dummy_write_query_tree(void);
 extern List *get_dummy_read_query_tree(void);
-extern Node * get_dummy_insert_query_node(void);
+extern Node *get_dummy_insert_query_node(void);
 #endif                                                 /* PARSER_H */
index eb5c48ccfee98fcb275e0c491be9e69710c63ab1..7ebf4c43994333109c4bb231d3902bf16d61fdb6 100644 (file)
@@ -145,7 +145,7 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat
  *             the format of pg_class relation.