pgpool2.git / summary / log / commit / refs

commit    3743744e2995bc52670203ff45721143340ba478
Author:   Toshihiro Kitagawa <kitagawa at sraoss.co.jp>
Date:     Wed Aug 04 02:58:38 2010 +0000

    Remove unused codes.


pool_proto_modules.c | 210 +++++++------------------------------------------ pool_proto_modules.h | 3 - pool_session_context.h | 3 - 3 files changed, 27 insertions(+), 189 deletions(-) diff --git a/pool_proto_modules.c b/pool_proto_modules.c index 513afbcea..bea623136 100644 --- a/pool_proto_modules.c +++ b/pool_proto_modules.c @@ -56,9 +56,6 @@ #include "pool_query_context.h" #include "pool_lobj.h" -int force_replication; -int replication_was_enabled; /* replication mode was enabled */ -int master_slave_was_enabled; /* master/slave mode was enabled */ int internal_transaction_started; /* to issue table lock command a transaction has been started internally */ char *copy_table = NULL; /* copy table name */ @@ -259,83 +256,6 @@ POOL_STATUS SimpleQuery(POOL_CONNECTION *frontend, return POOL_CONTINUE; } - if (IsA(node, PrepareStmt) || IsA(node, DeallocateStmt) || - IsA(node, VariableSetStmt) || IsA(node, DiscardStmt)) - { - /* - * Before we did followings only when frontend != NULL, - * which was wrong since if, for example, reset_query_list - * contains "DISCARD ALL", then it does not register - * pending function and it causes trying to DEALLOCATE non - * existing prepared statment(2009/4/3 Tatsuo). - */ - if (IsA(node, PrepareStmt)) - { -#ifdef NOT_USED - PreparedStatement *ps; - - ps = pool_create_prepared_statement(((PrepareStmt *)node)->name, - 0, 0, NULL, query_context); - if (ps == NULL) - { - pool_error("SimpleQuery: failed to create prepared statement: %s", strerror(errno)); - return POOL_END; - } - - session_context->pending_pstmt = ps; -#endif - } - else if (IsA(node, DeallocateStmt)) - { -#ifdef NOT_USED - char *name; - PreparedStatement *ps; - - name = ((DeallocateStmt *)node)->name; - if (name == NULL) - ps = pool_create_prepared_statement("", 0, 0, NULL, query_context); - else - ps = pool_create_prepared_statement(name, 0, 0, NULL, query_context); - if (ps == NULL) - { - pool_error("SimpleQuery: failed to create prepared statement: %s", strerror(errno)); - return POOL_END; - } - - session_context->pending_pstmt = ps; - - if (name == NULL) - session_context->pending_function = pool_clear_prepared_statement_list; - else - session_context->pending_function = pool_remove_prepared_statement; -#endif - } - else if (IsA(node, DiscardStmt)) - { - DiscardStmt *stmt = (DiscardStmt *)node; - if (stmt->target == DISCARD_ALL || stmt->target == DISCARD_PLANS) - { - session_context->pending_pstmt = NULL; - session_context->pending_portal = NULL; - } - } - } - - if (frontend && IsA(node, ExecuteStmt)) - { -#ifdef NOT_USED - PreparedStatement *ps; - - ps = pool_get_prepared_statement_by_pstmt_name(((ExecuteStmt *)node)->name); - if (ps) - { - free_parser(); - pool_query_context_destroy(query_context); - query_context = ps->qctxt; - } -#endif - } - /* * Decide where to send query */ @@ -544,10 +464,6 @@ POOL_STATUS Execute(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, pool_debug("Execute: query: %s", query); strncpy(query_string_buffer, query, sizeof(query_string_buffer)); -#ifdef NOT_USED - pool_set_query_in_progress(); -#endif - /* * Decide where to send query */ @@ -558,27 +474,6 @@ POOL_STATUS Execute(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, if (IsA(query_context->parse_tree, DeallocateStmt)) overwrite_map_for_deallocate(query_context); -#ifdef NOT_USED - /* - * JDBC driver sends "BEGIN" query internally if - * setAutoCommit(false). But it does not send Sync message - * after "BEGIN" query. In extended query protocol, - * PostgreSQL returns ReadyForQuery when a client sends Sync - * message. Problem is, pgpool can't know the transaction - * state without receiving ReadyForQuery. So we remember that - * we need to send Sync message internally afterward, whenever - * we receive BEGIN in extended protocol. - */ - if (IsA(node, TransactionStmt) && MASTER_SLAVE) - { - TransactionStmt *stmt = (TransactionStmt *) node; - - if (stmt->kind == TRANS_STMT_BEGIN || stmt->kind == TRANS_STMT_START) - /* Remember we need to send sync later in extended protocol */ - receive_extended_begin = 1; - } -#endif - /* check if query is "COMMIT" or "ROLLBACK" */ commit = is_commit_query(node); @@ -616,15 +511,11 @@ POOL_STATUS Execute(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, if (pool_send_and_wait(query_context, msg, len, -1, MASTER_NODE_ID, "E") != POOL_CONTINUE) return POOL_END; } -#ifdef NOT_USED else { -#endif if (pool_send_and_wait(query_context, contents, len, -1, MASTER_NODE_ID, "E") != POOL_CONTINUE) return POOL_END; -#ifdef NOT_USED } -#endif /* send "COMMIT" or "ROLLBACK" to only master node if query is "COMMIT" or "ROLLBACK" */ if (commit) @@ -647,28 +538,6 @@ POOL_STATUS Execute(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, } } -#ifdef NOT_USED - while ((ret = read_kind_from_backend(frontend, backend, &kind)) == POOL_CONTINUE) - { - /* - * forward message until receiving CommandComplete, - * ErrorResponse, EmptyQueryResponse or PortalSuspend. - */ - if (kind == 'C' || kind == 'E' || kind == 'I' || kind == 's') - break; - - status = SimpleForwardToFrontend(kind, frontend, backend); - if (status != POOL_CONTINUE) - return status; - } - if (ret != POOL_CONTINUE) - return ret; - - status = SimpleForwardToFrontend(kind, frontend, backend); - if (status != POOL_CONTINUE) - return status; -#endif - return POOL_CONTINUE; } @@ -901,25 +770,6 @@ POOL_STATUS Parse(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, */ /* free_parser(); */ -#ifdef NOT_USED - for (;;) - { - char kind; - POOL_STATUS ret; - ret = read_kind_from_backend(frontend, backend, &kind); - - if (ret != POOL_CONTINUE) - return ret; - - SimpleForwardToFrontend(kind, frontend, backend); - pool_flush(frontend); - - /* Ignore warning messages */ - if (kind != 'N') - break; - } -#endif - return POOL_CONTINUE; } @@ -997,27 +847,21 @@ POOL_STATUS Bind(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, if (pool_send_and_wait(query_context, contents, len, 1, MASTER_NODE_ID, "B") != POOL_CONTINUE) { -#ifdef NOT_USED if (rewrite_msg != NULL) - free(rewrite_msg); -#endif + /* free(rewrite_msg) */; return POOL_END; } if (pool_send_and_wait(query_context, contents, len, -1, MASTER_NODE_ID, "B") != POOL_CONTINUE) { -#ifdef NOT_USED if (rewrite_msg != NULL) - free(rewrite_msg); -#endif + /* free(rewrite_msg) */; return POOL_END; } -#ifdef NOT_USED if (rewrite_msg != NULL) - free(rewrite_msg); -#endif + /* free(rewrite_msg) */; return POOL_CONTINUE; } @@ -1371,9 +1215,6 @@ POOL_STATUS ReadyForQuery(POOL_CONNECTION *frontend, } if (pool_is_query_in_progress() && pool_is_command_success()) -#ifdef NOT_USED - if (pool_is_query_in_progress()) -#endif { Node *node; char *query; @@ -1585,6 +1426,16 @@ POOL_STATUS CommandComplete(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *bac pool_clear_prepared_statement_list(); } } + /* + * JDBC driver sends "BEGIN" query internally if + * setAutoCommit(false). But it does not send Sync message + * after "BEGIN" query. In extended query protocol, + * PostgreSQL returns ReadyForQuery when a client sends Sync + * message. Problem is, pgpool can't know the transaction + * state without receiving ReadyForQuery. So we remember that + * we need to send Sync message internally afterward, whenever + * we receive BEGIN in extended protocol. + */ else if (IsA(node, TransactionStmt)) { TransactionStmt *stmt = (TransactionStmt *) node; @@ -1853,26 +1704,6 @@ POOL_STATUS ProcessFrontendResponse(POOL_CONNECTION *frontend, if (fkind != 'S' && pool_is_ignore_till_sync()) return POOL_CONTINUE; -#ifdef NOT_USED - /* - * If we have received BEGIN in extended protocol before, we need - * to send a sync message to know the transaction stare. - */ - if (receive_extended_begin) - { - receive_extended_begin = 0; - - /* send sync message */ - send_extended_protocol_message(backend, MASTER_NODE_ID, "S", 0, ""); - - kind = pool_read_kind(backend); - if (kind != 'Z') - return POOL_END; - if (ReadyForQuery(frontend, backend, 0) != POOL_CONTINUE) - return POOL_END; - } -#endif - pool_unset_doing_extended_query_message(); switch (fkind) @@ -2071,6 +1902,12 @@ POOL_STATUS ProcessBackendResponse(POOL_CONNECTION *frontend, pool_unset_query_in_progress(); break; + case 'I': /* EmptyQueryResponse */ + status = SimpleForwardToFrontend(kind, frontend, backend); + if (pool_is_doing_extended_query_message()) + pool_unset_query_in_progress(); + break; + case 'T': /* RowDescription */ status = SimpleForwardToFrontend(kind, frontend, backend); if (pool_is_doing_extended_query_message()) @@ -2079,7 +1916,14 @@ POOL_STATUS ProcessBackendResponse(POOL_CONNECTION *frontend, case 'n': /* NoData */ status = SimpleForwardToFrontend(kind, frontend, backend); - pool_unset_query_in_progress(); + if (pool_is_doing_extended_query_message()) + pool_unset_query_in_progress(); + break; + + case 's': /* PortalSuspended */ + status = SimpleForwardToFrontend(kind, frontend, backend); + if (pool_is_doing_extended_query_message()) + pool_unset_query_in_progress(); break; default: diff --git a/pool_proto_modules.h b/pool_proto_modules.h index 27d35562f..200fef5fe 100644 --- a/pool_proto_modules.h +++ b/pool_proto_modules.h @@ -37,9 +37,6 @@ #define SPECIFIED_ERROR 1 #define POOL_ERROR_QUERY "send invalid query from pgpool to abort transaction" -extern int force_replication; -extern int replication_was_enabled; /* replication mode was enabled */ -extern int master_slave_was_enabled; /* master/slave mode was enabled */ extern int internal_transaction_started; /* to issue table lock command a transaction has been started internally */ extern char *copy_table; /* copy table name */ diff --git a/pool_session_context.h b/pool_session_context.h index 5ce6b378e..c73ab3b43 100644 --- a/pool_session_context.h +++ b/pool_session_context.h @@ -167,9 +167,6 @@ typedef struct { #ifdef NOT_USED /* We need to override these gotchas... */ - int force_replication; - int replication_was_enabled; /* replication mode was enabled */ - int master_slave_was_enabled; /* master/slave mode was enabled */ int internal_transaction_started; /* to issue table lock command a transaction has been started internally */ int mismatch_ntuples; /* number of updated tuples */ [parent: d36c141b9538]