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

Commit63956be

Browse files
committed
Rename logical_replication_mode to debug_logical_replication_streaming
The logical_replication_mode GUC is intended for testing and debuggingpurposes, but its current name may be misleading and encourage users to makeunnecessary changes.To avoid confusion, renaming the GUC to a less misleading namedebug_logical_replication_streaming that casual users are less likely to mistakenlyassume needs to be modified in a regular logical replication setup.Author: Hou Zhijie <houzj.fnst@cn.fujitsu.com>Reviewed-by: Peter Smith <smithpb2250@gmail.com>Discussion:https://www.postgresql.org/message-id/flat/d672d774-c44b-6fec-f993-793e744f169a%40eisentraut.org
1 parentf347ec7 commit63956be

File tree

10 files changed

+41
-41
lines changed

10 files changed

+41
-41
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11712,10 +11712,10 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
1171211712
</listitem>
1171311713
</varlistentry>
1171411714

11715-
<varlistentry id="guc-logical-replication-mode" xreflabel="logical_replication_mode">
11716-
<term><varname>logical_replication_mode</varname> (<type>enum</type>)
11715+
<varlistentry id="guc-debug-logical-replication-streaming" xreflabel="debug_logical_replication_streaming">
11716+
<term><varname>debug_logical_replication_streaming</varname> (<type>enum</type>)
1171711717
<indexterm>
11718-
<primary><varname>logical_replication_mode</varname> configuration parameter</primary>
11718+
<primary><varname>debug_logical_replication_streaming</varname> configuration parameter</primary>
1171911719
</indexterm>
1172011720
</term>
1172111721
<listitem>
@@ -11724,12 +11724,12 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
1172411724
<literal>immediate</literal>. The default is <literal>buffered</literal>.
1172511725
This parameter is intended to be used to test logical decoding and
1172611726
replication of large transactions. The effect of
11727-
<varname>logical_replication_mode</varname> is different for the
11727+
<varname>debug_logical_replication_streaming</varname> is different for the
1172811728
publisher and subscriber:
1172911729
</para>
1173011730

1173111731
<para>
11732-
On the publisher side, <varname>logical_replication_mode</varname>
11732+
On the publisher side, <varname>debug_logical_replication_streaming</varname>
1173311733
allows streaming or serializing changes immediately in logical decoding.
1173411734
When set to <literal>immediate</literal>, stream each change if the
1173511735
<link linkend="sql-createsubscription-with-streaming"><literal>streaming</literal></link>
@@ -11742,7 +11742,7 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
1174211742

1174311743
<para>
1174411744
On the subscriber side, if the <literal>streaming</literal> option is set to
11745-
<literal>parallel</literal>, <varname>logical_replication_mode</varname>
11745+
<literal>parallel</literal>, <varname>debug_logical_replication_streaming</varname>
1174611746
can be used to direct the leader apply worker to send changes to the
1174711747
shared memory queue or to serialize all changes to the file. When set to
1174811748
<literal>buffered</literal>, the leader sends changes to parallel apply

‎src/backend/replication/logical/applyparallelworker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ pa_send_data(ParallelApplyWorkerInfo *winfo, Size nbytes, const void *data)
11601160
* We don't try to send data to parallel worker for 'immediate' mode. This
11611161
* is primarily used for testing purposes.
11621162
*/
1163-
if (unlikely(logical_replication_mode==LOGICAL_REP_MODE_IMMEDIATE))
1163+
if (unlikely(debug_logical_replication_streaming==DEBUG_LOGICAL_REP_STREAMING_IMMEDIATE))
11641164
return false;
11651165

11661166
/*

‎src/backend/replication/logical/reorderbuffer.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ intlogical_decoding_work_mem;
210210
staticconstSizemax_changes_in_memory=4096;/* XXX for restore only */
211211

212212
/* GUC variable */
213-
intlogical_replication_mode=LOGICAL_REP_MODE_BUFFERED;
213+
intdebug_logical_replication_streaming=DEBUG_LOGICAL_REP_STREAMING_BUFFERED;
214214

215215
/* ---------------------------------------
216216
* primary reorderbuffer support routines
@@ -3566,8 +3566,8 @@ ReorderBufferLargestStreamableTopTXN(ReorderBuffer *rb)
35663566
* pick the largest (sub)transaction at-a-time to evict and spill its changes to
35673567
* disk or send to the output plugin until we reach under the memory limit.
35683568
*
3569-
* Iflogical_replication_mode is set to "immediate", stream or serialize the
3570-
* changes immediately.
3569+
* Ifdebug_logical_replication_streaming is set to "immediate", stream or
3570+
*serialize thechanges immediately.
35713571
*
35723572
* XXX At this point we select the transactions until we reach under the memory
35733573
* limit, but we might also adapt a more elaborate eviction strategy - for example
@@ -3580,25 +3580,25 @@ ReorderBufferCheckMemoryLimit(ReorderBuffer *rb)
35803580
ReorderBufferTXN*txn;
35813581

35823582
/*
3583-
* Bail out iflogical_replication_mode is buffered and we haven't
3584-
* exceeded the memory limit.
3583+
* Bail out ifdebug_logical_replication_streaming is buffered and we
3584+
*haven'texceeded the memory limit.
35853585
*/
3586-
if (logical_replication_mode==LOGICAL_REP_MODE_BUFFERED&&
3586+
if (debug_logical_replication_streaming==DEBUG_LOGICAL_REP_STREAMING_BUFFERED&&
35873587
rb->size<logical_decoding_work_mem*1024L)
35883588
return;
35893589

35903590
/*
3591-
* Iflogical_replication_mode is immediate, loop until there's no change.
3592-
* Otherwise, loop until we reach under the memory limit. One might think
3593-
* that just by evicting the largest (sub)transaction we will come under
3594-
* the memory limit based on assumption that the selected transaction is
3595-
* at least as large as the most recent change (which caused us to go over
3596-
* the memory limit). However, that is not true because a user can reduce
3597-
*the logical_decoding_work_mem to a smaller value before themost recent
3598-
* change.
3591+
* Ifdebug_logical_replication_streaming is immediate, loop until there's
3592+
*no change.Otherwise, loop until we reach under the memory limit. One
3593+
*might thinkthat just by evicting the largest (sub)transaction we will
3594+
*come underthe memory limit based on assumption that the selected
3595+
*transaction isat least as large as the most recent change (which
3596+
*caused us to go overthe memory limit). However, that is not true
3597+
*because a user can reduce thelogical_decoding_work_mem to a smaller
3598+
*value before the most recentchange.
35993599
*/
36003600
while (rb->size >=logical_decoding_work_mem*1024L||
3601-
(logical_replication_mode==LOGICAL_REP_MODE_IMMEDIATE&&
3601+
(debug_logical_replication_streaming==DEBUG_LOGICAL_REP_STREAMING_IMMEDIATE&&
36023602
rb->size>0))
36033603
{
36043604
/*

‎src/backend/utils/misc/guc_tables.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ static const struct config_enum_entry ssl_protocol_versions_info[] = {
420420
{NULL,0, false}
421421
};
422422

423-
staticconststructconfig_enum_entrylogical_replication_mode_options[]= {
424-
{"buffered",LOGICAL_REP_MODE_BUFFERED, false},
425-
{"immediate",LOGICAL_REP_MODE_IMMEDIATE, false},
423+
staticconststructconfig_enum_entrydebug_logical_replication_streaming_options[]= {
424+
{"buffered",DEBUG_LOGICAL_REP_STREAMING_BUFFERED, false},
425+
{"immediate",DEBUG_LOGICAL_REP_STREAMING_IMMEDIATE, false},
426426
{NULL,0, false}
427427
};
428428

@@ -4969,15 +4969,15 @@ struct config_enum ConfigureNamesEnum[] =
49694969
},
49704970

49714971
{
4972-
{"logical_replication_mode",PGC_USERSET,DEVELOPER_OPTIONS,
4973-
gettext_noop("Controls when to replicateorapply each change."),
4972+
{"debug_logical_replication_streaming",PGC_USERSET,DEVELOPER_OPTIONS,
4973+
gettext_noop("Forces immediate streamingorserialization of changes in large transactions."),
49744974
gettext_noop("On the publisher, it allows streaming or serializing each change in logical decoding. "
49754975
"On the subscriber, it allows serialization of all changes to files and notifies the "
49764976
"parallel apply workers to read and apply them at the end of the transaction."),
49774977
GUC_NOT_IN_SAMPLE
49784978
},
4979-
&logical_replication_mode,
4980-
LOGICAL_REP_MODE_BUFFERED,logical_replication_mode_options,
4979+
&debug_logical_replication_streaming,
4980+
DEBUG_LOGICAL_REP_STREAMING_BUFFERED,debug_logical_replication_streaming_options,
49814981
NULL,NULL,NULL
49824982
},
49834983

‎src/include/replication/reorderbuffer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
/* GUC variables */
2121
externPGDLLIMPORTintlogical_decoding_work_mem;
22-
externPGDLLIMPORTintlogical_replication_mode;
22+
externPGDLLIMPORTintdebug_logical_replication_streaming;
2323

24-
/* possible values forlogical_replication_mode */
24+
/* possible values fordebug_logical_replication_streaming */
2525
typedefenum
2626
{
27-
LOGICAL_REP_MODE_BUFFERED,
28-
LOGICAL_REP_MODE_IMMEDIATE
29-
}LogicalRepMode;
27+
DEBUG_LOGICAL_REP_STREAMING_BUFFERED,
28+
DEBUG_LOGICAL_REP_STREAMING_IMMEDIATE
29+
}DebugLogicalRepStreamingMode;
3030

3131
/* an individual tuple, stored in one chunk of memory */
3232
typedefstructReorderBufferTupleBuf

‎src/test/subscription/t/015_stream.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ sub test_streaming
295295
# Test serializing changes to files and notify the parallel apply worker to
296296
# apply them at the end of the transaction.
297297
$node_subscriber->append_conf('postgresql.conf',
298-
'logical_replication_mode = immediate');
298+
'debug_logical_replication_streaming = immediate');
299299
# Reset the log_min_messages to default.
300300
$node_subscriber->append_conf('postgresql.conf',
301301
"log_min_messages = warning");

‎src/test/subscription/t/016_stream_subxact.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ sub test_streaming
7979
my$node_publisher = PostgreSQL::Test::Cluster->new('publisher');
8080
$node_publisher->init(allows_streaming=>'logical');
8181
$node_publisher->append_conf('postgresql.conf',
82-
'logical_replication_mode = immediate');
82+
'debug_logical_replication_streaming = immediate');
8383
$node_publisher->start;
8484

8585
# Create subscriber node

‎src/test/subscription/t/018_stream_subxact_abort.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ sub test_streaming
130130
my$node_publisher = PostgreSQL::Test::Cluster->new('publisher');
131131
$node_publisher->init(allows_streaming=>'logical');
132132
$node_publisher->append_conf('postgresql.conf',
133-
'logical_replication_mode = immediate');
133+
'debug_logical_replication_streaming = immediate');
134134
$node_publisher->start;
135135

136136
# Create subscriber node
@@ -203,7 +203,7 @@ sub test_streaming
203203
# Test serializing changes to files and notify the parallel apply worker to
204204
# apply them at the end of the transaction.
205205
$node_subscriber->append_conf('postgresql.conf',
206-
'logical_replication_mode = immediate');
206+
'debug_logical_replication_streaming = immediate');
207207
# Reset the log_min_messages to default.
208208
$node_subscriber->append_conf('postgresql.conf',
209209
"log_min_messages = warning");

‎src/test/subscription/t/019_stream_subxact_ddl_abort.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
my$node_publisher = PostgreSQL::Test::Cluster->new('publisher');
1717
$node_publisher->init(allows_streaming=>'logical');
1818
$node_publisher->append_conf('postgresql.conf',
19-
'logical_replication_mode = immediate');
19+
'debug_logical_replication_streaming = immediate');
2020
$node_publisher->start;
2121

2222
# Create subscriber node

‎src/test/subscription/t/023_twophase_stream.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ sub test_streaming
301301
$node_publisher->append_conf(
302302
'postgresql.conf',qq(
303303
max_prepared_transactions = 10
304-
logical_replication_mode = immediate
304+
debug_logical_replication_streaming = immediate
305305
));
306306
$node_publisher->start;
307307

@@ -389,7 +389,7 @@ sub test_streaming
389389
# Test serializing changes to files and notify the parallel apply worker to
390390
# apply them at the end of the transaction.
391391
$node_subscriber->append_conf('postgresql.conf',
392-
'logical_replication_mode = immediate');
392+
'debug_logical_replication_streaming = immediate');
393393
# Reset the log_min_messages to default.
394394
$node_subscriber->append_conf('postgresql.conf',
395395
"log_min_messages = warning");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp