SLRU_PAGES_PER_SEGMENT as configure parameter
Hi,
The constant SLRU_PAGES_PER_SEGMENT defines the size of the SLRU
segments. It is currently hardcoded in slru.h. It would be nice to be
able to set this parameter during configuration (for example, by
analogy with --with-segsize-blocks).
What will it give us:
1) The ability to test pg_upgrade more extensively, since without it
you need to generate too much data to fill a significant number of
segments.
2) The number of segments is arbitrary: 32. However, I have not heard
about any estimates in terms of performance; with such a patch (for
REL_17_STABLE), it will be realistic to do this.
--
Best regards,
Daniil Davydov
Attachments:
0001-SLRU_PAGES_PER_SEGMENT-as-configure-parameter.patchtext/x-patch; charset=US-ASCII; name=0001-SLRU_PAGES_PER_SEGMENT-as-configure-parameter.patchDownload+228-110
On 6 Feb 2025, at 11:53, Daniil Davydov <3danissimo@gmail.com> wrote:
The constant SLRU_PAGES_PER_SEGMENT defines the size of the SLRU
segments. It is currently hardcoded in slru.h. It would be nice to be
able to set this parameter during configuration (for example, by
analogy with --with-segsize-blocks).
Not commenting on the gist of the patch, but the mechanics:
configure | 52 ++++++++
You should include the configure.ac changes and not just the generated code in
configure (which is fine to include for review, but the committer will
re-generate it regardless). Please also include the corresponding Meson change
to keep the buildsystems in sync.
--
Daniel Gustafsson
On Thu, Feb 6, 2025 at 8:23 PM Daniel Gustafsson <daniel@yesql.se> wrote:
You should include the configure.ac changes and not just the generated code in
configure (which is fine to include for review, but the committer will
re-generate it regardless). Please also include the corresponding Meson change
to keep the buildsystems in sync.
Thank you for your comment. I'm applying a patch that also includes
configure.ac, meson_options.txt and meson.build changes.
It would also be interesting to know what you think about the idea of
allowing such a parameter to be configured.
--
Best regards,
Daniil Davydov
Attachments:
0002-SLRU_PAGES_PER_SEGMENT-as-configure-parameter.patchtext/x-patch; charset=US-ASCII; name=0002-SLRU_PAGES_PER_SEGMENT-as-configure-parameter.patchDownload+287-110
On 7 Feb 2025, at 06:54, Daniil Davydov <3danissimo@gmail.com> wrote:
On Thu, Feb 6, 2025 at 8:23 PM Daniel Gustafsson <daniel@yesql.se> wrote:
You should include the configure.ac changes and not just the generated code in
configure (which is fine to include for review, but the committer will
re-generate it regardless). Please also include the corresponding Meson change
to keep the buildsystems in sync.Thank you for your comment. I'm applying a patch that also includes
configure.ac, meson_options.txt and meson.build changes.
+AC_DEFINE_UNQUOTED([SLRU_PAGES_PER_SEGMENT], ${slru_pages_per_segment}, [
+ SLRU segment size in pages. A page is the same BLCKSZ as is used everywhere
+ else in Postgres. The segment size can be chosen somewhat arbitrarily;
+ ...
It's not per project style to add large paragraphs like that to autoconf or
Meson, which segways nicely into commenting that the GUC and the build-time
parameters are missing from the documentation. Something like the above
message should be in the documentation rather than the build infrastructure.
- elog(NOTICE, "Called SlruSyncFileTag() for segment %lld on path %s",
- (long long) ftag.segno, path);
-
...
- elog(NOTICE, "Called SlruDeleteSegment() for segment %lld",
- (long long) ftag.segno);
-
What's the motivation for these changes?
It would also be interesting to know what you think about the idea of
allowing such a parameter to be configured.
It could perhaps be useful for (mostly) testing purposes, but since it requires
recompilation why not just change SLRU_PAGES_PER_SEGMENT in slru.h and
recompile? That would save a lot of code while achieving the same thing no?
If you foresee a performance enchancement in production usecases at certaint
values I recommend doing benchmarking to show this.
--
Daniel Gustafsson