postgresql/src/backend/utils
Heikki Linnakangas b70c2143bb Move a few ResourceOwnerEnlarge() calls for safety and clarity.
These are functions where a lot of things happen between the
ResourceOwnerEnlarge and ResourceOwnerRemember calls. It's important
that there are no unrelated ResourceOwnerRemember calls in the code in
between, otherwise the reserved entry might be used up by the
intervening ResourceOwnerRemember and not be available at the intended
ResourceOwnerRemember call anymore. I don't see any bugs here, but the
longer the code path between the calls is, the harder it is to verify.

In bufmgr.c, there is a function similar to ResourceOwnerEnlarge,
ReservePrivateRefCountEntry(), to ensure that the private refcount
array has enough space. The ReservePrivateRefCountEntry() calls were
made at different places than the ResourceOwnerEnlargeBuffers()
calls. Move the ResourceOwnerEnlargeBuffers() and
ReservePrivateRefCountEntry() calls together for consistency.

Reviewed-by: Aleksander Alekseev, Michael Paquier, Julien Rouhaud
Reviewed-by: Kyotaro Horiguchi, Hayato Kuroda, Álvaro Herrera, Zhihong Yu
Reviewed-by: Peter Eisentraut, Andres Freund
Discussion: https://www.postgresql.org/message-id/cbfabeb0-cd3c-e951-a572-19b365ed314d%40iki.fi
2023-11-08 13:30:46 +02:00
..
activity Remove distprep 2023-11-06 15:18:04 +01:00
adt Stop including parsenodes.h in plannodes.h 2023-11-07 19:26:39 +01:00
cache Move a few ResourceOwnerEnlarge() calls for safety and clarity. 2023-11-08 13:30:46 +02:00
error Avoid calling proc_exit() in processes forked by system(). 2023-10-17 10:41:48 -05:00
fmgr Fix code indentation violations introduced by recent commit 2023-08-11 20:43:34 +09:00
hash Update copyright for 2023 2023-01-02 15:00:37 -05:00
init Set GUC "is_superuser" in all processes that set AuthenticatedUserId. 2023-11-06 06:14:13 -08:00
mb Remove distprep 2023-11-06 15:18:04 +01:00
misc Remove distprep 2023-11-06 15:18:04 +01:00
mmgr Shrink memory contexts struct sizes 2023-07-17 11:16:56 +12:00
resowner Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
sort Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
time Improve error message for snapshot import in snapmgr.c, take two 2023-09-19 10:19:50 +09:00
.gitignore Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
Gen_dummy_probes.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
Gen_dummy_probes.pl.prolog Update copyright for 2023 2023-01-02 15:00:37 -05:00
Gen_dummy_probes.sed Update copyright for 2023 2023-01-02 15:00:37 -05:00
Gen_fmgrtab.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
README.Gen_dummy_probes Tweak generation of Gen_dummy_probes.pl 2021-05-11 20:02:02 -04:00
errcodes.txt Remove the "snapshot too old" feature. 2023-09-05 19:53:43 +12:00
generate-errcodes.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
postprocess_dtrace.sed Update copyright for 2023 2023-01-02 15:00:37 -05:00
probes.d bufmgr: Introduce infrastructure for faster relation extension 2023-04-05 16:21:09 -07:00

README.Gen_dummy_probes

# Generating dummy probes

If Postgres isn't configured with dtrace enabled, we need to generate
dummy probes for the entries in probes.d, that do nothing.

This is accomplished in Unix via the sed script `Gen_dummy_probes.sed`. We
used to use this in MSVC builds using the perl utility `psed`, which mimicked
sed. However, that utility disappeared from Windows perl distributions and so
we converted the sed script to a perl script to be used in MSVC builds.

We still keep the sed script as the authoritative source for generating
these dummy probes because except on Windows perl is not a hard requirement
when building from a tarball.

So, if you need to change the way dummy probes are generated, first change
the sed script, and when it's working generate the perl script. This can
be accomplished by using the perl utility s2p.

s2p is no longer part of the perl core, so it might not be on your system,
but it is available on CPAN and also in many package systems. e.g.
on Fedora it can be installed using `cpan App::s2p` or
`dnf install perl-App-s2p`.

The Makefile contains a recipe for regenerating Gen_dummy_probes.pl, so all
you need to do is once you have s2p installed is `make Gen_dummy_probes.pl`
Note that in a VPATH build this will generate the file in the vpath tree,
not the source tree.