diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 22bcf171ff..1f76939baa 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -214,6 +214,7 @@ static const Size max_changes_in_memory = 4096; /* XXX for restore only */ /* GUC variable */ int debug_logical_replication_streaming = DEBUG_LOGICAL_REP_STREAMING_BUFFERED; +int rb_mem_block_size = 8192 * 1024L; /* --------------------------------------- * primary reorderbuffer support routines @@ -341,11 +342,12 @@ ReorderBufferAllocate(void) * growing code. These values should likely be benchmarked and set to * more suitable values. */ + elog(LOG, "RB MEM BLOCK SIZE %ld", rb_mem_block_size * 1024L); buffer->tup_context = GenerationContextCreate(new_ctx, "Tuples", - SLAB_LARGE_BLOCK_SIZE, - SLAB_LARGE_BLOCK_SIZE, - SLAB_LARGE_BLOCK_SIZE); + rb_mem_block_size * 1024L, + rb_mem_block_size * 1024L, + rb_mem_block_size * 1024L); hash_ctl.keysize = sizeof(TransactionId); hash_ctl.entrysize = sizeof(ReorderBufferTXNByIdEnt); diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 686309db58..7e2e492521 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -2085,6 +2085,16 @@ struct config_bool ConfigureNamesBool[] = struct config_int ConfigureNamesInt[] = { + { + {"rb_mem_block_size", PGC_USERSET, RESOURCES_MEM, + gettext_noop(""), + NULL, + GUC_UNIT_KB + }, + &rb_mem_block_size, + 8192 * 1024L, 0, MAX_KILOBYTES, + NULL, NULL, NULL + }, { {"archive_timeout", PGC_SIGHUP, WAL_ARCHIVING, gettext_noop("Sets the amount of time to wait before forcing a " diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h index e332635f70..37bc37236a 100644 --- a/src/include/replication/reorderbuffer.h +++ b/src/include/replication/reorderbuffer.h @@ -26,6 +26,7 @@ /* GUC variables */ extern PGDLLIMPORT int logical_decoding_work_mem; extern PGDLLIMPORT int debug_logical_replication_streaming; +extern PGDLLIMPORT int rb_mem_block_size; /* possible values for debug_logical_replication_streaming */ typedef enum