postgresql/src/backend/utils
Robert Haas 9c08aea6a3 Add new block-by-block strategy for CREATE DATABASE.
Because this strategy logs changes on a block-by-block basis, it
avoids the need to checkpoint before and after the operation.
However, because it logs each changed block individually, it might
generate a lot of extra write-ahead logging if the template database
is large. Therefore, the older strategy remains available via a new
STRATEGY parameter to CREATE DATABASE, and a corresponding --strategy
option to createdb.

Somewhat controversially, this patch assembles the list of relations
to be copied to the new database by reading the pg_class relation of
the template database. Cross-database access like this isn't normally
possible, but it can be made to work here because there can't be any
connections to the database being copied, nor can it contain any
in-doubt transactions. Even so, we have to use lower-level interfaces
than normal, since the table scan and relcache interfaces will not
work for a database to which we're not connected. The advantage of
this approach is that we do not need to rely on the filesystem to
determine what ought to be copied, but instead on PostgreSQL's own
knowledge of the database structure. This avoids, for example,
copying stray files that happen to be located in the source database
directory.

Dilip Kumar, with a fairly large number of cosmetic changes by me.
Reviewed and tested by Ashutosh Sharma, Andres Freund, John Naylor,
Greg Nancarrow, Neha Sharma. Additional feedback from Bruce Momjian,
Heikki Linnakangas, Julien Rouhaud, Adam Brusselback, Kyotaro
Horiguchi, Tomas Vondra, Andrew Dunstan, Álvaro Herrera, and others.

Discussion: http://postgr.es/m/CA+TgmoYtcdxBjLh31DLxUXHxFVMPGzrU5_T=CYCvRyFHywSBUQ@mail.gmail.com
2022-03-29 11:48:36 -04:00
..
activity Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
adt Add system view pg_ident_file_mappings 2022-03-29 10:15:48 +09:00
cache Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
error Introduce log_destination=jsonlog 2022-01-17 10:16:53 +09:00
fmgr Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
hash Update copyright for 2022 2022-01-07 19:04:57 -05:00
init Add option to use ICU as global locale provider 2022-03-17 11:13:16 +01:00
mb Update copyright for 2022 2022-01-07 19:04:57 -05:00
misc IS JSON predicate 2022-03-28 15:37:08 -04:00
mmgr Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
resowner Update copyright for 2022 2022-01-07 19:04:57 -05:00
sort Add UNIQUE null treatment option 2022-02-03 11:48:21 +01:00
time Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
.gitignore
Gen_dummy_probes.pl Update copyright for 2022 2022-01-07 19:04:57 -05:00
Gen_dummy_probes.pl.prolog Update copyright for 2022 2022-01-07 19:04:57 -05:00
Gen_dummy_probes.sed Update copyright for 2022 2022-01-07 19:04:57 -05:00
Gen_fmgrtab.pl Update copyright for 2022 2022-01-07 19:04:57 -05:00
Makefile Correct Makefile dependencies for catalog scripts 2022-02-14 09:07:09 +07:00
README.Gen_dummy_probes Tweak generation of Gen_dummy_probes.pl 2021-05-11 20:02:02 -04:00
errcodes.txt Update copyright for 2022 2022-01-07 19:04:57 -05:00
generate-errcodes.pl Update copyright for 2022 2022-01-07 19:04:57 -05:00
probes.d Update copyright for 2022 2022-01-07 19:04:57 -05: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.