pgpool2.git / summary / log / commit / refs

commit    4bcba5258130c3cd9f855157a4359aad2fa7acfc
Author:   Tatsuo Ishii <ishii@sraoss.co.jp>
Date:     Mon Jan 31 08:11:02 2022 +0000

    Enhance parameter status handling.
    
    When a parameter status message arrives from backend, Pgpool-II
    memorized it but did not forward to frontend.  This commit allows
    forwarding a parameter status message to frontend.


src/protocol/pool_process_query.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/protocol/pool_process_query.c b/src/protocol/pool_process_query.c index 29acdc7cb..b996cd0a6 100644 --- a/src/protocol/pool_process_query.c +++ b/src/protocol/pool_process_query.c @@ -3374,7 +3374,7 @@ read_kind_from_backend(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backen errdetail("backend:%d kind:'%c'", i, kind))); /* - * Read and discard parameter status and notice messages + * Read and forward notice messages to frontend */ if (kind == 'N') { @@ -3383,17 +3383,23 @@ read_kind_from_backend(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backen pool_process_notice_message_from_one_backend(frontend, backend, i, kind); } + /* + * Read and forward ParameterStatus messages to frontend + */ else if (kind == 'S') { + int len2; + pool_read(CONNECTION(backend, i), &len, sizeof(len)); + len2 = len; len = htonl(len) - 4; p = pool_read2(CONNECTION(backend, i), len); if (p) { value = p + strlen(p) + 1; - ereport(DEBUG5, - (errmsg("reading backend data packet kind"), - errdetail("parameter name: %s value: \"%s\"", p, value))); + ereport(LOG, + (errmsg("ParameterStatus message from backend: %d", i), + errdetail("parameter name: \"%s\" value: \"%s\"", p, value))); if (IS_MAIN_NODE_ID(i)) { @@ -3405,7 +3411,10 @@ read_kind_from_backend(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backen set_application_name_with_string(pool_find_name(&CONNECTION(backend, i)->params, p, &pos)); } } - + /* forward to frontend */ + pool_write(frontend, &kind, 1); + pool_write(frontend, &len2, sizeof(len2)); + pool_write_and_flush(frontend, p, len); } else { @@ -3414,7 +3423,6 @@ read_kind_from_backend(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backen errdetail("read from backend failed"))); } } - } while (kind == 'S' || kind == 'N'); #ifdef DEALLOCATE_ERROR_TEST [parent: b4a788eaeb35]