Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 80426b3

Browse files
committed
Fix passing options from startup package to backend
1 parent f5c8913 commit 80426b3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/backend/postmaster/proxy.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,13 @@ backend_reschedule(Channel* chan, bool is_new)
215215
static size_t
216216
string_length(char const* str)
217217
{
218-
size_t length;
219-
if (str == NULL)
218+
size_t spaces = 0;
219+
char const* p = str;
220+
if (p == NULL)
220221
return 0;
221-
while (*str != '\0')
222-
length += (*str++ == ' ') ? 2 : 1;
223-
return length;
222+
while (*p != '\0')
223+
spaces += (*p++ == ' ');
224+
return (p - str) + spaces;
224225
}
225226

226227
static size_t
@@ -371,8 +372,8 @@ client_connect(Channel* chan, int startup_packet_size)
371372
if (!string_list_equal(chan->pool->startup_gucs, chan->client_port->guc_options) ||
372373
!string_equal(chan->pool->cmdline_options, chan->client_port->cmdline_options))
373374
{
374-
elog(LOG, "Ignoring GUCs of client %s:%s",
375-
NULLSTR(chan->client_port->remote_host), NULLSTR(chan->client_port->remote_port));
375+
elog(LOG, "Ignoring GUCs of client %s",
376+
NULLSTR(chan->client_port->application_name));
376377
}
377378
}
378379
}
@@ -941,7 +942,7 @@ backend_start(SessionPool* pool, char** error)
941942
{
942943
Channel* chan;
943944
char postmaster_port[8];
944-
char* options = (char*)palloc(string_length(pool->cmdline_options) + string_list_length(pool->startup_gucs) + list_length(pool->startup_gucs)*5 + 1);
945+
char* options = (char*)palloc(string_length(pool->cmdline_options) + string_list_length(pool->startup_gucs) + list_length(pool->startup_gucs)/2*5 + 1);
945946
char const* keywords[] = {"port","dbname","user","sslmode","application_name","options",NULL};
946947
char const* values[] = {postmaster_port,pool->key.database,pool->key.username,"disable","pool_worker",options,NULL};
947948
PGconn* conn;
@@ -982,7 +983,6 @@ backend_start(SessionPool* pool, char** error)
982983
}
983984
}
984985
*dst = '\0';
985-
elog(LOG, "Spawn backend with parameters \"%s\"", options);
986986
conn = LibpqConnectdbParams(keywords, values, error);
987987
pfree(options);
988988
if (!conn)

0 commit comments

Comments
 (0)