git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2d4a614)
Introduce BYTES unit for GUCs.
2017年9月12日 19:13:12 +0000 (12:13 -0700)
2017年9月12日 19:13:12 +0000 (12:13 -0700)
This is already useful for track_activity_query_size, and will further
be used in a later commit making the WAL segment size configurable.

Author: Beena Emerson
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/CAOG9ApEu8bXVwBxkOO9J7ZpM76TASK_vFMEEiCEjwhMmSLiaqQ@mail.gmail.com


diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index a05fb1a7eb3e25a74791058a415907b1cf22e721..bc9f09a08689dacc9eb78d0d68457a8e65ef6a07 100644 (file)
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -722,6 +722,11 @@ static const char *memory_units_hint = gettext_noop("Valid units for this parame
static const unit_conversion memory_unit_conversion_table[] =
{
+ {"GB", GUC_UNIT_BYTE, 1024 * 1024 * 1024},
+ {"MB", GUC_UNIT_BYTE, 1024 * 1024},
+ {"kB", GUC_UNIT_BYTE, 1024},
+ {"B", GUC_UNIT_BYTE, 1},
+
{"TB", GUC_UNIT_KB, 1024 * 1024 * 1024},
{"GB", GUC_UNIT_KB, 1024 * 1024},
{"MB", GUC_UNIT_KB, 1024},
@@ -2863,11 +2868,7 @@ static struct config_int ConfigureNamesInt[] =
{"track_activity_query_size", PGC_POSTMASTER, RESOURCES_MEM,
gettext_noop("Sets the size reserved for pg_stat_activity.query, in bytes."),
NULL,
-
- /*
- * There is no _bytes_ unit, so the user can't supply units for
- * this.
- */
+ GUC_UNIT_BYTE
},
&pgstat_track_activity_query_size,
1024, 100, 102400,
@@ -8113,6 +8114,9 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
{
switch (conf->flags & (GUC_UNIT_MEMORY | GUC_UNIT_TIME))
{
+ case GUC_UNIT_BYTE:
+ values[2] = "B";
+ break;
case GUC_UNIT_KB:
values[2] = "kB";
break;
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index c1870d213014342f84888746eac23f71691e73e5..467125a09da41b591917e2bcb3ec4e0aeb16d866 100644 (file)
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -219,6 +219,7 @@ typedef enum
#define GUC_UNIT_BLOCKS 0x2000 /* value is in blocks */
#define GUC_UNIT_XBLOCKS 0x3000 /* value is in xlog blocks */
#define GUC_UNIT_MB 0x4000 /* value is in megabytes */
+#define GUC_UNIT_BYTE 0x8000 /* value is in bytes */
#define GUC_UNIT_MEMORY 0xF000 /* mask for size-related units */
#define GUC_UNIT_MS 0x10000 /* value is in milliseconds */
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /