diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index e9f542cfedd..d14ea851847 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -2649,10 +2649,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 }, @@ -10709,6 +10710,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 b0365254f65..cc5eedfc41d 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