diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index e9d57b4..5c69359 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -2200,6 +2200,7 @@ ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid, change->data.tuplecid.cmax = cmax; change->data.tuplecid.combocid = combocid; change->lsn = lsn; + change->txn = txn; change->action = REORDER_BUFFER_CHANGE_INTERNAL_TUPLECID; dlist_push_tail(&txn->tuplecids, &change->node); @@ -2479,7 +2480,7 @@ ReorderBufferSerializeTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) /* update the statistics */ rb->spillCount += 1; - rb->spillTxns += txn->serialized ? 1 : 0; + rb->spillTxns += txn->serialized ? 0 : 1; rb->spillBytes += size; Assert(spilled == txn->nentries_mem); @@ -3292,7 +3293,7 @@ ReorderBufferToastReplace(ReorderBuffer *rb, ReorderBufferTXN *txn, return; /* - * We're going modify the size of the change, so to make sure the + * We're going to modify the size of the change, so to make sure the * accounting is correct we'll make it look like we're removing the * change now (with the old size), and then re-add it at the end. */ diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 5d7e687..c7252cf 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -192,7 +192,6 @@ static bool check_maxconnections(int *newval, void **extra, GucSource source); static bool check_max_worker_processes(int *newval, void **extra, GucSource source); static bool check_autovacuum_max_workers(int *newval, void **extra, GucSource source); static bool check_max_wal_senders(int *newval, void **extra, GucSource source); -static bool check_logical_decoding_work_mem(int *newval, void **extra, GucSource source); static bool check_autovacuum_work_mem(int *newval, void **extra, GucSource source); static bool check_effective_io_concurrency(int *newval, void **extra, GucSource source); static void assign_effective_io_concurrency(int newval, void *extra); @@ -2261,8 +2260,8 @@ static struct config_int ConfigureNamesInt[] = GUC_UNIT_KB }, &logical_decoding_work_mem, - -1, -1, MAX_KILOBYTES, - check_logical_decoding_work_mem, NULL, NULL + 65536, 64, MAX_KILOBYTES, + NULL, NULL, NULL }, /* @@ -11300,28 +11299,6 @@ check_max_wal_senders(int *newval, void **extra, GucSource source) } static bool -check_logical_decoding_work_mem(int *newval, void **extra, GucSource source) -{ - /* - * -1 indicates fallback. - * - * If we haven't yet changed the boot_val default of -1, just let it be. - * logical decoding will look to maintenance_work_mem instead. - */ - if (*newval == -1) - return true; - - /* - * We clamp manually-set values to at least 64kB. The maintenance_work_mem - * uses a higher minimum value (1MB), so this is OK. - */ - if (*newval < 64) - *newval = 64; - - return true; -} - -static bool check_autovacuum_work_mem(int *newval, void **extra, GucSource source) { /* diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 00a22b8..04529aa 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -130,7 +130,7 @@ #work_mem = 4MB # min 64kB #maintenance_work_mem = 64MB # min 1MB #autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem -#logical_decoding_work_mem = 64MB # min 1MB, or -1 to use maintenance_work_mem +i#logical_decoding_work_mem = 64MB # min 64kB #max_stack_depth = 2MB # min 100kB #shared_memory_type = mmap # the default is the first option # supported by the operating system: