You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
postgres/src/bin/pg_waldump/Makefile

67 lines
1.5 KiB

# src/bin/pg_waldump/Makefile
PGFILEDESC = "pg_waldump - decode and display WAL"
PGAPPICON=win32
subdir = src/bin/pg_waldump
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
OBJS = \
$(RMGRDESCOBJS) \
$(WIN32RES) \
compat.o \
pg_waldump.o \
rmgrdesc.o \
xlogreader.o \
xlogstats.o
override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
ifeq ($(enable_percona_ext),yes)
OBJS += \
$(top_srcdir)/src/fe_utils/simple_list.o \
PG-1294 WAL: encrypt segment ranges This commit changes the approach to WAL encryption. Instead of encrypting each WAL page and keeping its header unencrypted with a special encrypted flag, this change moves encrypted/unencrypted bookkeeping to WAL internal keys. Now every [WAL] internal key has an additional field `start_lsn`. The field indicates the first WAL record that was encrypted with this key. This means everything starting from that LSN is encrypted with the key until the next or the end of the WAL. In order to have unencrypted WAL (when the user sets `pg_tde.wal_encrypt = off`), we insert a special key with the flag `TDE_KEY_TYPE_WAL_UNENCRYPTED`. The user can turn WAL encryption on and off, which will generate a new WAL key with the respective state (`TDE_KEY_TYPE_WAL_ENCRYPTED` or `TDE_KEY_TYPE_WAL_UNENCRYPTED `). If GUC pg_tde.wal_encrypt was changed, the server will generate a new WAL key with `start_lsn` set to `InvalidXLogRecPtr` on start. WAL writer, in turn, will update `start_lsn` with the actual LSN on the first write since the key creation. We use the current key _map and _dat files infrastructure along with the Internal key cache but with some special cases. There might be multiple internal keys for WAL but only one for the SMGR (relations, indexes etc). Creating a new WAL key, we write it the same as the SMGR key, so key rotation, for example, doesn't require any changes. But reads and start_lsn happen directly from/in _dat file (omitting _map). This needs revision and refactoring (along with _map, _dat files in general). As well as WAL keys cache, which is currently a simple linked list referencing the actual internal key case. That allows WAL key changing.
7 months ago
$(top_builddir)/src/libtde/libtdexlog.a \
$(top_builddir)/src/libtde/libtde.a
override CPPFLAGS := -I$(top_srcdir)/contrib/pg_tde/src/include -I$(top_srcdir)/contrib/pg_tde/src/libkmip/libkmip/include $(CPPFLAGS)
endif
RMGRDESCSOURCES = $(sort $(notdir $(wildcard $(top_srcdir)/src/backend/access/rmgrdesc/*desc*.c)))
RMGRDESCOBJS = $(patsubst %.c,%.o,$(RMGRDESCSOURCES))
all: pg_waldump
pg_waldump: $(OBJS) | submake-libpgport
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
xlogreader.c: % : $(top_srcdir)/src/backend/access/transam/%
rm -f $@ && $(LN_S) $< .
xlogstats.c: % : $(top_srcdir)/src/backend/access/transam/%
rm -f $@ && $(LN_S) $< .
$(RMGRDESCSOURCES): % : $(top_srcdir)/src/backend/access/rmgrdesc/%
rm -f $@ && $(LN_S) $< .
install: all installdirs
$(INSTALL_PROGRAM) pg_waldump$(X) '$(DESTDIR)$(bindir)/pg_waldump$(X)'
installdirs:
$(MKDIR_P) '$(DESTDIR)$(bindir)'
uninstall:
rm -f '$(DESTDIR)$(bindir)/pg_waldump$(X)'
Remove distprep A PostgreSQL release tarball contains a number of prebuilt files, in particular files produced by bison, flex, perl, and well as html and man documentation. We have done this consistent with established practice at the time to not require these tools for building from a tarball. Some of these tools were hard to get, or get the right version of, from time to time, and shipping the prebuilt output was a convenience to users. Now this has at least two problems: One, we have to make the build system(s) work in two modes: Building from a git checkout and building from a tarball. This is pretty complicated, but it works so far for autoconf/make. It does not currently work for meson; you can currently only build with meson from a git checkout. Making meson builds work from a tarball seems very difficult or impossible. One particular problem is that since meson requires a separate build directory, we cannot make the build update files like gram.h in the source tree. So if you were to build from a tarball and update gram.y, you will have a gram.h in the source tree and one in the build tree, but the way things work is that the compiler will always use the one in the source tree. So you cannot, for example, make any gram.y changes when building from a tarball. This seems impossible to fix in a non-horrible way. Second, there is increased interest nowadays in precisely tracking the origin of software. We can reasonably track contributions into the git tree, and users can reasonably track the path from a tarball to packages and downloads and installs. But what happens between the git tree and the tarball is obscure and in some cases non-reproducible. The solution for both of these issues is to get rid of the step that adds prebuilt files to the tarball. The tarball now only contains what is in the git tree (*). Getting the additional build dependencies is no longer a problem nowadays, and the complications to keep these dual build modes working are significant. And of course we want to get the meson build system working universally. This commit removes the make distprep target altogether. The make dist target continues to do its job, it just doesn't call distprep anymore. (*) - The tarball also contains the INSTALL file that is built at make dist time, but not by distprep. This is unchanged for now. The make maintainer-clean target, whose job it is to remove the prebuilt files in addition to what make distclean does, is now just an alias to make distprep. (In practice, it is probably obsolete given that git clean is available.) The following programs are now hard build requirements in configure (they were already required by meson.build): - bison - flex - perl Reviewed-by: Michael Paquier <michael@paquier.xyz> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
2 years ago
clean distclean:
rm -f pg_waldump$(X) $(OBJS) $(RMGRDESCSOURCES) xlogreader.c xlogstats.c
rm -rf tmp_check
check:
$(prove_check)
installcheck:
$(prove_installcheck)