mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-03 14:52:21 +02:00
Centralize PostgreSQL page header data structures.
These data structures were copied a few places (but only once in the core code) so put them in a place where everyone can use them. To do this create a new file, static.auto.h, to contain data types and macros that have stayed the same through all the versions of PostgreSQL that we support. This allows us to have single, non-versioned set of headers and code for stable data structures like page headers. Migrate a few types from version.auto.h that are required for page header structures and pull the remaining types from PostgreSQL directly. We had previously renamed xlog to wal so update those where required since we won't be modifying the PostgreSQL names anymore.
This commit is contained in:
parent
a88d709962
commit
9d48882268
@ -509,43 +509,43 @@ postgres/client.o: postgres/client.c build.auto.h common/assert.h common/debug.h
|
||||
postgres/interface.o: postgres/interface.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.h postgres/version.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface.c -o postgres/interface.o
|
||||
|
||||
postgres/interface/v083.o: postgres/interface/v083.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v083.o: postgres/interface/v083.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v083.c -o postgres/interface/v083.o
|
||||
|
||||
postgres/interface/v084.o: postgres/interface/v084.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v084.o: postgres/interface/v084.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v084.c -o postgres/interface/v084.o
|
||||
|
||||
postgres/interface/v090.o: postgres/interface/v090.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v090.o: postgres/interface/v090.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v090.c -o postgres/interface/v090.o
|
||||
|
||||
postgres/interface/v091.o: postgres/interface/v091.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v091.o: postgres/interface/v091.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v091.c -o postgres/interface/v091.o
|
||||
|
||||
postgres/interface/v092.o: postgres/interface/v092.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v092.o: postgres/interface/v092.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v092.c -o postgres/interface/v092.o
|
||||
|
||||
postgres/interface/v093.o: postgres/interface/v093.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v093.o: postgres/interface/v093.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v093.c -o postgres/interface/v093.o
|
||||
|
||||
postgres/interface/v094.o: postgres/interface/v094.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v094.o: postgres/interface/v094.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v094.c -o postgres/interface/v094.o
|
||||
|
||||
postgres/interface/v095.o: postgres/interface/v095.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v095.o: postgres/interface/v095.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v095.c -o postgres/interface/v095.o
|
||||
|
||||
postgres/interface/v096.o: postgres/interface/v096.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v096.o: postgres/interface/v096.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v096.c -o postgres/interface/v096.o
|
||||
|
||||
postgres/interface/v100.o: postgres/interface/v100.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v100.o: postgres/interface/v100.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v100.c -o postgres/interface/v100.o
|
||||
|
||||
postgres/interface/v110.o: postgres/interface/v110.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v110.o: postgres/interface/v110.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v110.c -o postgres/interface/v110.o
|
||||
|
||||
postgres/interface/v120.o: postgres/interface/v120.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/interface/v120.o: postgres/interface/v120.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) -c postgres/interface/v120.c -o postgres/interface/v120.o
|
||||
|
||||
postgres/pageChecksum.o: postgres/pageChecksum.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/pageChecksum.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
postgres/pageChecksum.o: postgres/pageChecksum.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/param.h common/type/string.h common/type/stringList.h common/type/stringz.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/static.auto.h postgres/pageChecksum.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(CMAKE) @COPTIMIZE_PAGE_CHECKSUM@ -c postgres/pageChecksum.c -o postgres/pageChecksum.o
|
||||
|
||||
protocol/client.o: protocol/client.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringz.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h version.h
|
||||
|
186
src/postgres/interface/static.auto.h
Normal file
186
src/postgres/interface/static.auto.h
Normal file
@ -0,0 +1,186 @@
|
||||
/***********************************************************************************************************************************
|
||||
PostgreSQL Types That Do Not Vary By Version
|
||||
|
||||
Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
||||
Portions Copyright (c) 1994, Regents of the University of California
|
||||
|
||||
Despite the .auto.h suffix this file is not automatically generated, though it could be. We use this suffix to emphasize that the
|
||||
types have been copied from PostgreSQL and to exclude this file from project code counts.
|
||||
|
||||
For each supported release of PostgreSQL check the types in this file to see if they have changed. The easiest way to do this is to
|
||||
copy and paste in place and check git to see if there are any diffs. Tabs should be copied as is to make this process easy even
|
||||
though the pgBackRest project does not use tabs elsewhere.
|
||||
|
||||
Comments should be copied with the types they apply to, even if the comment has not changed. This does get repetitive, but has no
|
||||
runtime cost and makes the rules a bit easier to follow.
|
||||
|
||||
If a comment is changed then the newer comment should be copied. If the *type* has changed then it must be moved to version.auto.c
|
||||
which could have a large impact on dependencies. Hopefully that won't happen often.
|
||||
|
||||
Note when adding new types it is safer to add them to version.auto.c unless they are needed for code that must be compatible across
|
||||
all versions of PostgreSQL supported by pgBackRest.
|
||||
***********************************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Types from src/include/c.h
|
||||
***********************************************************************************************************************************/
|
||||
|
||||
// uint16 type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
typedef uint16_t uint16;
|
||||
|
||||
// uint32 type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
typedef uint32_t uint32;
|
||||
|
||||
// TransactionId type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
typedef uint32 TransactionId;
|
||||
|
||||
// FLEXIBLE_ARRAY_MEMBER macro
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* We require C99, hence the compiler should understand flexible array
|
||||
* members. However, for documentation purposes we still consider it to be
|
||||
* project style to write "field[FLEXIBLE_ARRAY_MEMBER]" not just "field[]".
|
||||
* When computing the size of such an object, use "offsetof(struct s, f)"
|
||||
* for portability. Don't use "offsetof(struct s, f[0])", as this doesn't
|
||||
* work with MSVC and with C++ compilers.
|
||||
*/
|
||||
#define FLEXIBLE_ARRAY_MEMBER /* empty */
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Types from src/include/storage/itemid.h
|
||||
***********************************************************************************************************************************/
|
||||
|
||||
// ItemIdData type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* A line pointer on a buffer page. See buffer page definitions and comments
|
||||
* for an explanation of how line pointers are used.
|
||||
*
|
||||
* In some cases a line pointer is "in use" but does not have any associated
|
||||
* storage on the page. By convention, lp_len == 0 in every line pointer
|
||||
* that does not have storage, independently of its lp_flags state.
|
||||
*/
|
||||
typedef struct ItemIdData
|
||||
{
|
||||
unsigned lp_off:15, /* offset to tuple (from start of page) */
|
||||
lp_flags:2, /* state of line pointer, see below */
|
||||
lp_len:15; /* byte length of tuple */
|
||||
} ItemIdData;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Types from src/include/storage/block.h
|
||||
***********************************************************************************************************************************/
|
||||
|
||||
// BlockNumber type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* BlockNumber:
|
||||
*
|
||||
* each data file (heap or index) is divided into postgres disk blocks
|
||||
* (which may be thought of as the unit of i/o -- a postgres buffer
|
||||
* contains exactly one disk block). the blocks are numbered
|
||||
* sequentially, 0 to 0xFFFFFFFE.
|
||||
*
|
||||
* InvalidBlockNumber is the same thing as P_NEW in bufmgr.h.
|
||||
*
|
||||
* the access methods, the buffer manager and the storage manager are
|
||||
* more or less the only pieces of code that should be accessing disk
|
||||
* blocks directly.
|
||||
*/
|
||||
typedef uint32 BlockNumber;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Types from src/include/storage/bufpage.h
|
||||
***********************************************************************************************************************************/
|
||||
|
||||
// LocationIndex type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* location (byte offset) within a page.
|
||||
*
|
||||
* note that this is actually limited to 2^15 because we have limited
|
||||
* ItemIdData.lp_off and ItemIdData.lp_len to 15 bits (see itemid.h).
|
||||
*/
|
||||
typedef uint16 LocationIndex;
|
||||
|
||||
// PageXLogRecPtr type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* For historical reasons, the 64-bit LSN value is stored as two 32-bit
|
||||
* values.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32 xlogid; /* high bits */
|
||||
uint32 xrecoff; /* low bits */
|
||||
} PageXLogRecPtr;
|
||||
|
||||
// PageHeaderData type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* disk page organization
|
||||
*
|
||||
* space management information generic to any page
|
||||
*
|
||||
* pd_lsn - identifies xlog record for last change to this page.
|
||||
* pd_checksum - page checksum, if set.
|
||||
* pd_flags - flag bits.
|
||||
* pd_lower - offset to start of free space.
|
||||
* pd_upper - offset to end of free space.
|
||||
* pd_special - offset to start of special space.
|
||||
* pd_pagesize_version - size in bytes and page layout version number.
|
||||
* pd_prune_xid - oldest XID among potentially prunable tuples on page.
|
||||
*
|
||||
* The LSN is used by the buffer manager to enforce the basic rule of WAL:
|
||||
* "thou shalt write xlog before data". A dirty buffer cannot be dumped
|
||||
* to disk until xlog has been flushed at least as far as the page's LSN.
|
||||
*
|
||||
* pd_checksum stores the page checksum, if it has been set for this page;
|
||||
* zero is a valid value for a checksum. If a checksum is not in use then
|
||||
* we leave the field unset. This will typically mean the field is zero
|
||||
* though non-zero values may also be present if databases have been
|
||||
* pg_upgraded from releases prior to 9.3, when the same byte offset was
|
||||
* used to store the current timelineid when the page was last updated.
|
||||
* Note that there is no indication on a page as to whether the checksum
|
||||
* is valid or not, a deliberate design choice which avoids the problem
|
||||
* of relying on the page contents to decide whether to verify it. Hence
|
||||
* there are no flag bits relating to checksums.
|
||||
*
|
||||
* pd_prune_xid is a hint field that helps determine whether pruning will be
|
||||
* useful. It is currently unused in index pages.
|
||||
*
|
||||
* The page version number and page size are packed together into a single
|
||||
* uint16 field. This is for historical reasons: before PostgreSQL 7.3,
|
||||
* there was no concept of a page version number, and doing it this way
|
||||
* lets us pretend that pre-7.3 databases have page version number zero.
|
||||
* We constrain page sizes to be multiples of 256, leaving the low eight
|
||||
* bits available for a version number.
|
||||
*
|
||||
* Minimum possible page size is perhaps 64B to fit page header, opaque space
|
||||
* and a minimal tuple; of course, in reality you want it much bigger, so
|
||||
* the constraint on pagesize mod 256 is not an important restriction.
|
||||
* On the high end, we can only support pages up to 32KB because lp_off/lp_len
|
||||
* are 15 bits.
|
||||
*/
|
||||
|
||||
typedef struct PageHeaderData
|
||||
{
|
||||
/* XXX LSN is member of *any* block, not only page-organized ones */
|
||||
PageXLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog
|
||||
* record for last change to this page */
|
||||
uint16 pd_checksum; /* checksum */
|
||||
uint16 pd_flags; /* flag bits, see below */
|
||||
LocationIndex pd_lower; /* offset to start of free space */
|
||||
LocationIndex pd_upper; /* offset to end of free space */
|
||||
LocationIndex pd_special; /* offset to start of special space */
|
||||
uint16 pd_pagesize_version;
|
||||
TransactionId pd_prune_xid; /* oldest prunable XID, or zero if none */
|
||||
ItemIdData pd_linp[FLEXIBLE_ARRAY_MEMBER]; /* line pointer array */
|
||||
} PageHeaderData;
|
||||
|
||||
// PageHeader type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
typedef PageHeaderData *PageHeader;
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
PostgreSQL Types
|
||||
PostgreSQL Types That Vary By Version
|
||||
|
||||
Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
|
||||
Portions Copyright (c) 1994, Regents of the University of California
|
||||
@ -24,6 +24,7 @@ If a comment has syntax only changes, then the new version of the comment can be
|
||||
If a comment has changed in a way that implies a difference in the way the type is used, then a new version of the comment and type
|
||||
should be created. See the CheckPoint type difference between 9.5 and 9.6 as an example.
|
||||
***********************************************************************************************************************************/
|
||||
#include "postgres/interface/static.auto.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Types from src/include/c.h
|
||||
@ -39,26 +40,6 @@ typedef int64_t int64;
|
||||
|
||||
#endif
|
||||
|
||||
// uint16 type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_83
|
||||
|
||||
typedef uint16_t uint16;
|
||||
|
||||
#endif
|
||||
|
||||
// uint32 type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_83
|
||||
|
||||
typedef uint32_t uint32;
|
||||
|
||||
#endif
|
||||
|
||||
// uint64 type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
@ -69,16 +50,6 @@ typedef uint64_t uint64;
|
||||
|
||||
#endif
|
||||
|
||||
// transactionId type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_83
|
||||
|
||||
typedef uint32 TransactionId;
|
||||
|
||||
#endif
|
||||
|
||||
// MultiXactId type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
@ -70,45 +70,9 @@ minimize register spilling. For less sophisticated compilers it might be benefic
|
||||
#include "common/error.h"
|
||||
#include "common/log.h"
|
||||
#include "postgres/interface.h"
|
||||
#include "postgres/interface/static.auto.h"
|
||||
#include "postgres/pageChecksum.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
For historical reasons, the 64-bit LSN value is stored as two 32-bit values.
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t walid; // high bits
|
||||
uint32_t xrecoff; // low bits
|
||||
} PageWalRecPtr;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Space management information generic to any page. Only values required for pgBackRest are represented here.
|
||||
|
||||
pd_lsn - identifies wal record for last change to this page.
|
||||
pd_checksum - page checksum, if set.
|
||||
|
||||
The LSN is used by the buffer manager to enforce the basic rule of WAL: "thou shalt write wal before data". A dirty buffer cannot
|
||||
be dumped to disk until wal has been flushed at least as far as the page's LSN.
|
||||
|
||||
pd_checksum stores the page checksum, if it has been set for this page; zero is a valid value for a checksum. If a checksum is not
|
||||
in use then we leave the field unset. This will typically mean the field is zero though non-zero values may also be present if
|
||||
databases have been pg_upgraded from releases prior to 9.3, when the same byte offset was used to store the current timelineid when
|
||||
the page was last updated. Note that there is no indication on a page as to whether the checksum is valid or not, a deliberate
|
||||
design choice which avoids the problem of relying on the page contents to decide whether to verify it. Hence there are no flag bits
|
||||
relating to checksums.
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct PageHeaderData
|
||||
{
|
||||
// LSN is member of *any* block, not only page-organized ones
|
||||
PageWalRecPtr pd_lsn; // Lsn for last change to this page
|
||||
uint16_t pd_checksum; // checksum
|
||||
uint16_t pd_flags; // flag bits, see below
|
||||
uint16_t pd_lower; // offset to start of free space
|
||||
uint16_t pd_upper; // offset to end of free space
|
||||
} PageHeaderData;
|
||||
|
||||
typedef PageHeaderData *PageHeader;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
pageChecksumBlock - block checksum algorithm
|
||||
|
||||
@ -214,7 +178,7 @@ pageLsn(const unsigned char *page)
|
||||
FUNCTION_TEST_PARAM_P(UCHARDATA, page);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
FUNCTION_TEST_RETURN((uint64_t)((PageHeader)page)->pd_lsn.walid << 32 | ((PageHeader)page)->pd_lsn.xrecoff);
|
||||
FUNCTION_TEST_RETURN((uint64_t)((PageHeader)page)->pd_lsn.xlogid << 32 | ((PageHeader)page)->pd_lsn.xrecoff);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -238,7 +202,7 @@ pageChecksumTest(
|
||||
// This is a new page so don't test checksum
|
||||
((PageHeader)page)->pd_upper == 0 ||
|
||||
// LSN is after the backup started so checksum is not tested because pages may be torn
|
||||
(((PageHeader)page)->pd_lsn.walid >= ignoreWalId && ((PageHeader)page)->pd_lsn.xrecoff >= ignoreWalOffset) ||
|
||||
(((PageHeader)page)->pd_lsn.xlogid >= ignoreWalId && ((PageHeader)page)->pd_lsn.xrecoff >= ignoreWalOffset) ||
|
||||
// Checksum is valid if a full page
|
||||
(pageSize == PG_PAGE_SIZE_DEFAULT && ((PageHeader)page)->pd_checksum == pageChecksum(page, blockNo, pageSize)));
|
||||
}
|
||||
|
@ -5,27 +5,9 @@ Test Common Functions and Definitions for Backup and Expire Commands
|
||||
#include "common/regExp.h"
|
||||
#include "common/type/json.h"
|
||||
#include "postgres/interface.h"
|
||||
#include "postgres/interface/static.auto.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Need these structures to mock up test data
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t walid; // high bits
|
||||
uint32_t xrecoff; // low bits
|
||||
} PageWalRecPtr;
|
||||
|
||||
typedef struct PageHeaderData
|
||||
{
|
||||
// LSN is member of *any* block, not only page-organized ones
|
||||
PageWalRecPtr pd_lsn; // Lsn for last change to this page
|
||||
uint16_t pd_checksum; // checksum
|
||||
uint16_t pd_flags; // flag bits, see below
|
||||
uint16_t pd_lower; // offset to start of free space
|
||||
uint16_t pd_upper; // offset to end of free space
|
||||
} PageHeaderData;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Test Run
|
||||
***********************************************************************************************************************************/
|
||||
@ -150,9 +132,9 @@ testRun(void)
|
||||
*(PageHeaderData *)(bufPtr(buffer) + (PG_PAGE_SIZE_DEFAULT * 0x00)) = (PageHeaderData)
|
||||
{
|
||||
.pd_upper = 0x01,
|
||||
.pd_lsn = (PageWalRecPtr)
|
||||
.pd_lsn = (PageXLogRecPtr)
|
||||
{
|
||||
.walid = 0xF0F0F0F0,
|
||||
.xlogid = 0xF0F0F0F0,
|
||||
.xrecoff = 0xF0F0F0F0,
|
||||
},
|
||||
};
|
||||
@ -183,9 +165,9 @@ testRun(void)
|
||||
*(PageHeaderData *)(bufPtr(buffer) + (PG_PAGE_SIZE_DEFAULT * 0x00)) = (PageHeaderData)
|
||||
{
|
||||
.pd_upper = 0x01,
|
||||
.pd_lsn = (PageWalRecPtr)
|
||||
.pd_lsn = (PageXLogRecPtr)
|
||||
{
|
||||
.walid = 0xF0F0F0F0,
|
||||
.xlogid = 0xF0F0F0F0,
|
||||
.xrecoff = 0xF0F0F0F0,
|
||||
},
|
||||
};
|
||||
@ -194,9 +176,9 @@ testRun(void)
|
||||
*(PageHeaderData *)(bufPtr(buffer) + (PG_PAGE_SIZE_DEFAULT * 0x01)) = (PageHeaderData)
|
||||
{
|
||||
.pd_upper = 0x01,
|
||||
.pd_lsn = (PageWalRecPtr)
|
||||
.pd_lsn = (PageXLogRecPtr)
|
||||
{
|
||||
.walid = 0xFACEFACE,
|
||||
.xlogid = 0xFACEFACE,
|
||||
.xrecoff = 0x00000000,
|
||||
},
|
||||
};
|
||||
@ -205,7 +187,7 @@ testRun(void)
|
||||
*(PageHeaderData *)(bufPtr(buffer) + (PG_PAGE_SIZE_DEFAULT * 0x02)) = (PageHeaderData)
|
||||
{
|
||||
.pd_upper = 0x01,
|
||||
.pd_lsn = (PageWalRecPtr)
|
||||
.pd_lsn = (PageXLogRecPtr)
|
||||
{
|
||||
.xrecoff = 0x2,
|
||||
},
|
||||
@ -215,7 +197,7 @@ testRun(void)
|
||||
*(PageHeaderData *)(bufPtr(buffer) + (PG_PAGE_SIZE_DEFAULT * 0x03)) = (PageHeaderData)
|
||||
{
|
||||
.pd_upper = 0x01,
|
||||
.pd_lsn = (PageWalRecPtr)
|
||||
.pd_lsn = (PageXLogRecPtr)
|
||||
{
|
||||
.xrecoff = 0x3,
|
||||
},
|
||||
@ -225,7 +207,7 @@ testRun(void)
|
||||
*(PageHeaderData *)(bufPtr(buffer) + (PG_PAGE_SIZE_DEFAULT * 0x04)) = (PageHeaderData)
|
||||
{
|
||||
.pd_upper = 0x01,
|
||||
.pd_lsn = (PageWalRecPtr)
|
||||
.pd_lsn = (PageXLogRecPtr)
|
||||
{
|
||||
.xrecoff = 0x4,
|
||||
},
|
||||
@ -238,7 +220,7 @@ testRun(void)
|
||||
*(PageHeaderData *)(bufPtr(buffer) + (PG_PAGE_SIZE_DEFAULT * 0x06)) = (PageHeaderData)
|
||||
{
|
||||
.pd_upper = 0x01,
|
||||
.pd_lsn = (PageWalRecPtr)
|
||||
.pd_lsn = (PageXLogRecPtr)
|
||||
{
|
||||
.xrecoff = 0x6,
|
||||
},
|
||||
@ -248,7 +230,7 @@ testRun(void)
|
||||
*(PageHeaderData *)(bufPtr(buffer) + (PG_PAGE_SIZE_DEFAULT * 0x07)) = (PageHeaderData)
|
||||
{
|
||||
.pd_upper = 0x01,
|
||||
.pd_lsn = (PageWalRecPtr)
|
||||
.pd_lsn = (PageXLogRecPtr)
|
||||
{
|
||||
.xrecoff = 0x7,
|
||||
},
|
||||
|
@ -8,31 +8,13 @@ Test Backup Command
|
||||
#include "common/io/bufferRead.h"
|
||||
#include "common/io/bufferWrite.h"
|
||||
#include "common/io/io.h"
|
||||
#include "postgres/interface/static.auto.h"
|
||||
#include "storage/helper.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
#include "common/harnessConfig.h"
|
||||
#include "common/harnessPq.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Page header structure use to create realistic pages for testing
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t walid; // high bits
|
||||
uint32_t xrecoff; // low bits
|
||||
} PageWalRecPtr;
|
||||
|
||||
typedef struct PageHeaderData
|
||||
{
|
||||
// LSN is member of *any* block, not only page-organized ones
|
||||
PageWalRecPtr pd_lsn; // Lsn for last change to this page
|
||||
uint16_t pd_checksum; // checksum
|
||||
uint16_t pd_flags; // flag bits, see below
|
||||
uint16_t pd_lower; // offset to start of free space
|
||||
uint16_t pd_upper; // offset to end of free space
|
||||
} PageHeaderData;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get a list of all files in the backup
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -67,7 +67,7 @@ testRun(void)
|
||||
pageChecksumTest(testPage(0), 9999, TEST_PAGE_SIZE, 0xFFFF, 0xFFFF), false, "badchecksum, page 9999");
|
||||
|
||||
// Update LSNs and check that page checksums past the ignore limits are successful
|
||||
((PageHeader)testPage(0))->pd_lsn.walid = 0x8888;
|
||||
((PageHeader)testPage(0))->pd_lsn.xlogid = 0x8888;
|
||||
((PageHeader)testPage(0))->pd_lsn.xrecoff = 0x8888;
|
||||
|
||||
TEST_RESULT_UINT(pageLsn(testPage(0)), 0x0000888800008888, "check page lsn");
|
||||
|
Loading…
x
Reference in New Issue
Block a user