diff options
author | Amit Kapila <akapila@postgresql.org> | 2023-01-30 08:02:08 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2023-01-30 08:02:08 +0530 |
commit | 1e8b61735cfb1a4feb72cb9ea83db690fedbfef1 (patch) | |
tree | 480c77fb6007f535c8f20301954e483de1672ad6 /src/backend | |
parent | 8d2c1913ed3df9384973399deeb75fc1e55943fe (diff) | |
download | postgresql-1e8b61735cfb1a4feb72cb9ea83db690fedbfef1.tar.gz postgresql-1e8b61735cfb1a4feb72cb9ea83db690fedbfef1.zip |
Rename GUC logical_decoding_mode to logical_replication_mode.
Rename the developer option 'logical_decoding_mode' to the more flexible
name 'logical_replication_mode' because doing so will make it easier to
extend this option in the future to help test other areas of logical
replication.
Currently, it is used on the publisher side to allow streaming or
serializing each change in logical decoding. In the upcoming patch, we are
planning to use it on the subscriber. On the subscriber, it will allow
serializing the changes to file and notifies the parallel apply workers to
read and apply them at the end of the transaction.
We discussed exposing this parameter as a subscription option but
it did not seem advisable since it is primarily used for testing/debugging
and there is no other such parameter. We also discussed having separate
GUCs for publisher and subscriber but for current testing/debugging
requirements, one GUC is sufficient.
Author: Hou Zhijie
Reviewed-by: Peter Smith, Kuroda Hayato, Sawada Masahiko, Amit Kapila
Discussion: https://postgr.es/m/CAD21AoAy2c=Mx=FTCs+EwUsf2kQL5MmU3N18X84k0EmCXntK4g@mail.gmail.com
Discussion: https://postgr.es/m/CAA4eK1+wyN6zpaHUkCLorEWNx75MG0xhMwcFhvjqm2KURZEAGw@mail.gmail.com
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/replication/logical/reorderbuffer.c | 14 | ||||
-rw-r--r-- | src/backend/utils/misc/guc_tables.c | 16 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 54ee824e6c4..efe057b4de2 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -210,7 +210,7 @@ int logical_decoding_work_mem; static const Size max_changes_in_memory = 4096; /* XXX for restore only */ /* GUC variable */ -int logical_decoding_mode = LOGICAL_DECODING_MODE_BUFFERED; +int logical_replication_mode = LOGICAL_REP_MODE_BUFFERED; /* --------------------------------------- * primary reorderbuffer support routines @@ -3552,8 +3552,8 @@ ReorderBufferLargestStreamableTopTXN(ReorderBuffer *rb) * pick the largest (sub)transaction at-a-time to evict and spill its changes to * disk or send to the output plugin until we reach under the memory limit. * - * If logical_decoding_mode is set to "immediate", stream or serialize the changes - * immediately. + * If logical_replication_mode is set to "immediate", stream or serialize the + * changes immediately. * * XXX At this point we select the transactions until we reach under the memory * limit, but we might also adapt a more elaborate eviction strategy - for example @@ -3566,15 +3566,15 @@ ReorderBufferCheckMemoryLimit(ReorderBuffer *rb) ReorderBufferTXN *txn; /* - * Bail out if logical_decoding_mode is buffered and we haven't exceeded + * Bail out if logical_replication_mode is buffered and we haven't exceeded * the memory limit. */ - if (logical_decoding_mode == LOGICAL_DECODING_MODE_BUFFERED && + if (logical_replication_mode == LOGICAL_REP_MODE_BUFFERED && rb->size < logical_decoding_work_mem * 1024L) return; /* - * If logical_decoding_mode is immediate, loop until there's no change. + * If logical_replication_mode is immediate, loop until there's no change. * Otherwise, loop until we reach under the memory limit. One might think * that just by evicting the largest (sub)transaction we will come under * the memory limit based on assumption that the selected transaction is @@ -3584,7 +3584,7 @@ ReorderBufferCheckMemoryLimit(ReorderBuffer *rb) * change. */ while (rb->size >= logical_decoding_work_mem * 1024L || - (logical_decoding_mode == LOGICAL_DECODING_MODE_IMMEDIATE && + (logical_replication_mode == LOGICAL_REP_MODE_IMMEDIATE && rb->size > 0)) { /* diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 4ac808ed224..c5a95f5dcca 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -395,9 +395,9 @@ static const struct config_enum_entry ssl_protocol_versions_info[] = { {NULL, 0, false} }; -static const struct config_enum_entry logical_decoding_mode_options[] = { - {"buffered", LOGICAL_DECODING_MODE_BUFFERED, false}, - {"immediate", LOGICAL_DECODING_MODE_IMMEDIATE, false}, +static const struct config_enum_entry logical_replication_mode_options[] = { + {"buffered", LOGICAL_REP_MODE_BUFFERED, false}, + {"immediate", LOGICAL_REP_MODE_IMMEDIATE, false}, {NULL, 0, false} }; @@ -4919,13 +4919,13 @@ struct config_enum ConfigureNamesEnum[] = }, { - {"logical_decoding_mode", PGC_USERSET, DEVELOPER_OPTIONS, - gettext_noop("Allows streaming or serializing each change in logical decoding."), - NULL, + {"logical_replication_mode", PGC_USERSET, DEVELOPER_OPTIONS, + gettext_noop("Controls when to replicate each change."), + gettext_noop("On the publisher, it allows streaming or serializing each change in logical decoding."), GUC_NOT_IN_SAMPLE }, - &logical_decoding_mode, - LOGICAL_DECODING_MODE_BUFFERED, logical_decoding_mode_options, + &logical_replication_mode, + LOGICAL_REP_MODE_BUFFERED, logical_replication_mode_options, NULL, NULL, NULL }, |