diff options
Diffstat (limited to 'src/backend/utils/misc')
-rw-r--r-- | src/backend/utils/misc/guc.c | 30 | ||||
-rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 3 |
2 files changed, 27 insertions, 6 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 2499bee7399..d84dba7732e 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -685,6 +685,9 @@ typedef struct #if XLOG_BLCKSZ < 1024 || XLOG_BLCKSZ > (1024*1024) #error XLOG_BLCKSZ must be between 1KB and 1MB #endif +#if XLOG_SEG_SIZE < (1024*1024) || XLOG_BLCKSZ > (1024*1024*1024) +#error XLOG_SEG_SIZE must be between 1MB and 1GB +#endif static const char *memory_units_hint = gettext_noop("Valid units for this parameter are \"kB\", \"MB\", \"GB\", and \"TB\"."); @@ -706,6 +709,11 @@ static const unit_conversion memory_unit_conversion_table[] = { "MB", GUC_UNIT_XBLOCKS, 1024 / (XLOG_BLCKSZ / 1024) }, { "kB", GUC_UNIT_XBLOCKS, -(XLOG_BLCKSZ / 1024) }, + { "TB", GUC_UNIT_XSEGS, (1024*1024*1024) / (XLOG_SEG_SIZE / 1024) }, + { "GB", GUC_UNIT_XSEGS, (1024*1024) / (XLOG_SEG_SIZE / 1024) }, + { "MB", GUC_UNIT_XSEGS, -(XLOG_SEG_SIZE / (1024 * 1024)) }, + { "kB", GUC_UNIT_XSEGS, -(XLOG_SEG_SIZE / 1024) }, + { "" } /* end of table marker */ }; @@ -2146,16 +2154,28 @@ static struct config_int ConfigureNamesInt[] = }, { - {"checkpoint_segments", PGC_SIGHUP, WAL_CHECKPOINTS, - gettext_noop("Sets the maximum distance in log segments between automatic WAL checkpoints."), - NULL + {"min_wal_size", PGC_SIGHUP, WAL_CHECKPOINTS, + gettext_noop("Sets the minimum size to shrink the WAL to."), + NULL, + GUC_UNIT_XSEGS }, - &CheckPointSegments, - 3, 1, INT_MAX, + &min_wal_size, + 5, 2, INT_MAX, NULL, NULL, NULL }, { + {"max_wal_size", PGC_SIGHUP, WAL_CHECKPOINTS, + gettext_noop("Sets the WAL size that triggers a checkpoint."), + NULL, + GUC_UNIT_XSEGS + }, + &max_wal_size, + 8, 2, INT_MAX, + NULL, assign_max_wal_size, NULL + }, + + { {"checkpoint_timeout", PGC_SIGHUP, WAL_CHECKPOINTS, gettext_noop("Sets the maximum time between automatic WAL checkpoints."), NULL, diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 29d8485964d..f8f9ce18eca 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -197,8 +197,9 @@ # - Checkpoints - -#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each #checkpoint_timeout = 5min # range 30s-1h +#max_wal_size = 128MB # in logfile segments +#min_wal_size = 80MB #checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0 #checkpoint_warning = 30s # 0 disables |