summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAndres Freund2022-12-08 03:32:59 +0000
committerAndres Freund2022-12-08 03:32:59 +0000
commitd3b111e3205b6e681e16b4f8e6ed01f67142ce7b (patch)
treecdbac630df05839fb164f6726115b9f8dd2369d5 /configure.ac
parentbf07ab492c461460b4a69279abb2ef996b4f67ec (diff)
Add option to specify segment size in blocks
The tests don't have much coverage of segment related code, as we don't create large enough tables. To make it easier to test these paths, add a new option specifying the segment size in blocks. Set the new option to 6 blocks in one of the CI tasks. Smaller numbers currently fail one of the tests, for understandable reasons. While at it, fix some segment size related issues in the meson build. Author: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/20221107171355.c23fzwanfzq2pmgt@awork3.anarazel.de
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac36
1 files changed, 27 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index 0df13e5439f..cfb10f59ce7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -285,15 +285,31 @@ AC_DEFINE_UNQUOTED([BLCKSZ], ${BLCKSZ}, [
#
# Relation segment size
#
-AC_MSG_CHECKING([for segment size])
PGAC_ARG_REQ(with, segsize, [SEGSIZE], [set table segment size in GB [1]],
[segsize=$withval],
[segsize=1])
-# this expression is set up to avoid unnecessary integer overflow
-# blocksize is already guaranteed to be a factor of 1024
-RELSEG_SIZE=`expr '(' 1024 / ${blocksize} ')' '*' ${segsize} '*' 1024`
-test $? -eq 0 || exit 1
-AC_MSG_RESULT([${segsize}GB])
+PGAC_ARG_REQ(with, segsize-blocks, [SEGSIZE_BLOCKS], [set table segment size in blocks [0]],
+ [segsize_blocks=$withval],
+ [segsize_blocks=0])
+
+# If --with-segsize-blocks is non-zero, it is used, --with-segsize
+# otherwise. segsize-blocks is only really useful for developers wanting to
+# test segment related code. Warn if both are used.
+if test $segsize_blocks -ne 0 -a $segsize -ne 1; then
+ AC_MSG_WARN([both --with-segsize and --with-segsize-blocks specified, --with-segsize-blocks wins])
+fi
+
+AC_MSG_CHECKING([for segment size])
+if test $segsize_blocks -eq 0; then
+ # this expression is set up to avoid unnecessary integer overflow
+ # blocksize is already guaranteed to be a factor of 1024
+ RELSEG_SIZE=`expr '(' 1024 / ${blocksize} ')' '*' ${segsize} '*' 1024`
+ test $? -eq 0 || exit 1
+ AC_MSG_RESULT([${segsize}GB])
+else
+ RELSEG_SIZE=$segsize_blocks
+ AC_MSG_RESULT([${RELSEG_SIZE} blocks])
+fi
AC_DEFINE_UNQUOTED([RELSEG_SIZE], ${RELSEG_SIZE}, [
RELSEG_SIZE is the maximum number of blocks allowed in one disk file.
@@ -1733,9 +1749,11 @@ fi
dnl Check for largefile support (must be after AC_SYS_LARGEFILE)
AC_CHECK_SIZEOF([off_t])
-# If we don't have largefile support, can't handle segsize >= 2GB.
-if test "$ac_cv_sizeof_off_t" -lt 8 -a "$segsize" != "1"; then
- AC_MSG_ERROR([Large file support is not enabled. Segment size cannot be larger than 1GB.])
+# If we don't have largefile support, can't handle segment size >= 2GB.
+if test "$ac_cv_sizeof_off_t" -lt 8; then
+ if expr $RELSEG_SIZE '*' $blocksize '>=' 2 '*' 1024 '*' 1024; then
+ AC_MSG_ERROR([Large file support is not enabled. Segment size cannot be larger than 1GB.])
+ fi
fi
AC_CHECK_SIZEOF([bool], [],