Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9fab155

Browse files
committed
Make walsender always initialize the buffers.
Walsender uses the local buffers for each outgoing and incoming message.Previously when creating replication slot, walsender forgot to initializeone of them and which can cause the segmentation fault error. To fix thisissue, this commit changes walsender so that it always initialize thembefore it executes the requested replication command.Back-patch to 9.4 where replication slot was introduced.Problem report and initial patch by Stas Kelvich, modified by me.Report:https://www.postgresql.org/message-id/A1E9CB90-1FAC-4CAD-8DBA-9AA62A6E97C5@postgrespro.ru
1 parent62ed084 commit9fab155

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

‎src/backend/replication/walsender.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,6 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
808808
ReplicationSlotCreate(cmd->slotname, true,RS_EPHEMERAL);
809809
}
810810

811-
initStringInfo(&output_message);
812-
813811
if (cmd->kind==REPLICATION_KIND_LOGICAL)
814812
{
815813
LogicalDecodingContext*ctx;
@@ -1322,6 +1320,14 @@ exec_replication_command(const char *cmd_string)
13221320

13231321
cmd_node=replication_parse_result;
13241322

1323+
/*
1324+
* Allocate buffers that will be used for each outgoing and incoming
1325+
* message. We do this just once per command to reduce palloc overhead.
1326+
*/
1327+
initStringInfo(&output_message);
1328+
initStringInfo(&reply_message);
1329+
initStringInfo(&tmpbuf);
1330+
13251331
switch (cmd_node->type)
13261332
{
13271333
caseT_IdentifySystemCmd:
@@ -1791,14 +1797,6 @@ WalSndCheckTimeOut(TimestampTz now)
17911797
staticvoid
17921798
WalSndLoop(WalSndSendDataCallbacksend_data)
17931799
{
1794-
/*
1795-
* Allocate buffers that will be used for each outgoing and incoming
1796-
* message. We do this just once to reduce palloc overhead.
1797-
*/
1798-
initStringInfo(&output_message);
1799-
initStringInfo(&reply_message);
1800-
initStringInfo(&tmpbuf);
1801-
18021800
/*
18031801
* Initialize the last reply timestamp. That enables timeout processing
18041802
* from hereon.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp