aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-09-28 16:12:13 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-09-28 16:12:13 -0400
commita8fb03fceadb5fe9698ff0182ca76b0640348e70 (patch)
tree7b0e3e8110d56b09c6e7512fcc12629ad497f451
parent6c8671bc395c9be44571e424c458b94ec20975d3 (diff)
downloadpostgresql-a8fb03fceadb5fe9698ff0182ca76b0640348e70.tar.gz
postgresql-a8fb03fceadb5fe9698ff0182ca76b0640348e70.zip
Improve error reporting for unsupported effective_io_concurrency setting.
Give a specific error complaining about lack of posix_fadvise() when someone tries to set effective_io_concurrency > 0 on platforms without that. This probably isn't worth extensive back-patching, but I (tgl) felt cramming it into v11 was reasonable. James Robinson Discussion: https://postgr.es/m/153771876450.14994.560017943128223619@wrigleys.postgresql.org Discussion: https://postgr.es/m/A3942987-5BC7-4F05-B54D-2A0EC2914B33@jlr-photo.com
-rw-r--r--src/backend/utils/misc/guc.c10
-rw-r--r--src/include/pg_config_manual.h4
2 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 6264b7fbd04..110ac0e57fb 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -2641,10 +2641,11 @@ static struct config_int ConfigureNamesInt[] =
},
&effective_io_concurrency,
#ifdef USE_PREFETCH
- 1, 0, MAX_IO_CONCURRENCY,
+ 1,
#else
- 0, 0, 0,
+ 0,
#endif
+ 0, MAX_IO_CONCURRENCY,
check_effective_io_concurrency, assign_effective_io_concurrency, NULL
},
@@ -10681,6 +10682,11 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source)
else
return false;
#else
+ if (*newval != 0)
+ {
+ GUC_check_errdetail("effective_io_concurrency must be set to 0 on platforms that lack posix_fadvise()");
+ return false;
+ }
return true;
#endif /* USE_PREFETCH */
}
diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h
index b309395f11c..14336acb963 100644
--- a/src/include/pg_config_manual.h
+++ b/src/include/pg_config_manual.h
@@ -136,7 +136,9 @@
/*
* USE_PREFETCH code should be compiled only if we have a way to implement
* prefetching. (This is decoupled from USE_POSIX_FADVISE because there
- * might in future be support for alternative low-level prefetch APIs.)
+ * might in future be support for alternative low-level prefetch APIs.
+ * If you change this, you probably need to adjust the error message in
+ * check_effective_io_concurrency.)
*/
#ifdef USE_POSIX_FADVISE
#define USE_PREFETCH