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

Commit1d04a59

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 parentd365370 commit1d04a59

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
@@ -773,8 +773,6 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
773773
cmd->temporary ?RS_TEMPORARY :RS_EPHEMERAL);
774774
}
775775

776-
initStringInfo(&output_message);
777-
778776
if (cmd->kind==REPLICATION_KIND_LOGICAL)
779777
{
780778
LogicalDecodingContext*ctx;
@@ -1258,6 +1256,14 @@ exec_replication_command(const char *cmd_string)
12581256

12591257
cmd_node=replication_parse_result;
12601258

1259+
/*
1260+
* Allocate buffers that will be used for each outgoing and incoming
1261+
* message. We do this just once per command to reduce palloc overhead.
1262+
*/
1263+
initStringInfo(&output_message);
1264+
initStringInfo(&reply_message);
1265+
initStringInfo(&tmpbuf);
1266+
12611267
switch (cmd_node->type)
12621268
{
12631269
caseT_IdentifySystemCmd:
@@ -1736,14 +1742,6 @@ WalSndCheckTimeOut(TimestampTz now)
17361742
staticvoid
17371743
WalSndLoop(WalSndSendDataCallbacksend_data)
17381744
{
1739-
/*
1740-
* Allocate buffers that will be used for each outgoing and incoming
1741-
* message. We do this just once to reduce palloc overhead.
1742-
*/
1743-
initStringInfo(&output_message);
1744-
initStringInfo(&reply_message);
1745-
initStringInfo(&tmpbuf);
1746-
17471745
/*
17481746
* Initialize the last reply timestamp. That enables timeout processing
17491747
* from hereon.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp