Обсуждение: pgsql: Move the backup-block logic from XLogInsert to a new file, xlogi
Move the backup-block logic from XLogInsert to a new file, xloginsert.c. xlog.c is huge, this makes it a little bit smaller, which is nice. Functions related to putting together the WAL record are in xloginsert.c, and the lower level stuff for managing WAL buffers and such are in xlog.c. Also move the definition of XLogRecord to a separate header file. This causes churn in the #includes of all the files that write WAL records, and redo routines, but it avoids pulling in xlog.h into most places. Reviewed by Michael Paquier, Alvaro Herrera, Andres Freund and Amit Kapila. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/2076db2aea766c4c828dccc34ae35f614129000d Modified Files -------------- contrib/pg_xlogdump/pg_xlogdump.c | 2 +- doc/src/sgml/wal.sgml | 14 +- src/backend/access/gin/ginbtree.c | 1 + src/backend/access/gin/gindatapage.c | 1 + src/backend/access/gin/ginentrypage.c | 1 + src/backend/access/gin/ginfast.c | 1 + src/backend/access/gin/gininsert.c | 1 + src/backend/access/gin/ginutil.c | 1 + src/backend/access/gin/ginvacuum.c | 1 + src/backend/access/gist/gistbuild.c | 1 + src/backend/access/gist/gistxlog.c | 1 + src/backend/access/heap/heapam.c | 2 + src/backend/access/heap/pruneheap.c | 1 + src/backend/access/heap/rewriteheap.c | 1 + src/backend/access/heap/visibilitymap.c | 1 + src/backend/access/nbtree/nbtinsert.c | 1 + src/backend/access/nbtree/nbtpage.c | 2 + src/backend/access/nbtree/nbtree.c | 1 + src/backend/access/nbtree/nbtsort.c | 2 + src/backend/access/nbtree/nbtxlog.c | 2 + src/backend/access/spgist/spgdoinsert.c | 1 + src/backend/access/spgist/spginsert.c | 2 + src/backend/access/spgist/spgvacuum.c | 1 + src/backend/access/spgist/spgxlog.c | 1 + src/backend/access/transam/Makefile | 2 +- src/backend/access/transam/clog.c | 3 + src/backend/access/transam/multixact.c | 2 + src/backend/access/transam/twophase.c | 1 + src/backend/access/transam/varsup.c | 1 + src/backend/access/transam/xact.c | 2 + src/backend/access/transam/xlog.c | 761 +++---------------------------- src/backend/access/transam/xloginsert.c | 633 +++++++++++++++++++++++++ src/backend/access/transam/xlogreader.c | 2 +- src/backend/access/transam/xlogutils.c | 121 +++++ src/backend/catalog/heap.c | 1 + src/backend/catalog/namespace.c | 1 + src/backend/catalog/storage.c | 2 + src/backend/commands/cluster.c | 1 + src/backend/commands/copy.c | 1 + src/backend/commands/createas.c | 1 + src/backend/commands/dbcommands.c | 1 + src/backend/commands/matview.c | 1 + src/backend/commands/sequence.c | 2 + src/backend/commands/tablecmds.c | 1 + src/backend/commands/tablespace.c | 2 + src/backend/commands/vacuumlazy.c | 1 + src/backend/commands/variable.c | 1 + src/backend/storage/buffer/bufmgr.c | 1 + src/backend/storage/file/fd.c | 1 + src/backend/storage/ipc/procarray.c | 3 +- src/backend/storage/ipc/standby.c | 1 + src/backend/storage/lmgr/lock.c | 1 + src/backend/storage/lmgr/predicate.c | 1 + src/backend/tcop/utility.c | 1 + src/backend/utils/adt/txid.c | 1 + src/backend/utils/cache/relcache.c | 1 + src/backend/utils/cache/relmapper.c | 2 + src/backend/utils/init/postinit.c | 1 + src/backend/utils/sort/tuplestore.c | 2 + src/backend/utils/time/tqual.c | 1 + src/bin/pg_resetxlog/pg_resetxlog.c | 1 + src/include/access/clog.h | 3 +- src/include/access/gin.h | 3 +- src/include/access/gin_private.h | 1 + src/include/access/gist_private.h | 1 + src/include/access/hash.h | 3 +- src/include/access/heapam_xlog.h | 4 +- src/include/access/multixact.h | 3 +- src/include/access/nbtree.h | 5 +- src/include/access/spgist.h | 3 +- src/include/access/spgist_private.h | 1 + src/include/access/xact.h | 4 +- src/include/access/xlog.h | 112 +---- src/include/access/xlog_internal.h | 38 +- src/include/access/xloginsert.h | 66 +++ src/include/access/xlogrecord.h | 100 ++++ src/include/access/xlogutils.h | 8 +- src/include/catalog/storage_xlog.h | 3 +- src/include/commands/dbcommands.h | 3 +- src/include/commands/sequence.h | 3 +- src/include/commands/tablespace.h | 3 +- src/include/replication/decode.h | 1 + src/include/storage/standby.h | 3 +- src/include/utils/relmapper.h | 3 +- 84 files changed, 1123 insertions(+), 856 deletions(-)
Heikki Linnakangas wrote: > Move the backup-block logic from XLogInsert to a new file, xloginsert.c. > > xlog.c is huge, this makes it a little bit smaller, which is nice. Functions > related to putting together the WAL record are in xloginsert.c, and the > lower level stuff for managing WAL buffers and such are in xlog.c. > > Also move the definition of XLogRecord to a separate header file. This > causes churn in the #includes of all the files that write WAL records, and > redo routines, but it avoids pulling in xlog.h into most places. This commit broke the WAL_DEBUG case: /pgsql/source/brin/src/backend/access/transam/xlog.c: In function 'XLogInsertRecord': /pgsql/source/brin/src/backend/access/transam/xlog.c:1073:4: error: 'rdt_lastnormal' undeclared (first use in this function) rdt_lastnormal->next = NULL; ^ -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Re: pgsql: Move the backup-block logic from XLogInsert to a new file, xlogi
От
Heikki Linnakangas
Дата:
On 11/07/2014 08:28 PM, Alvaro Herrera wrote: > Heikki Linnakangas wrote: >> Move the backup-block logic from XLogInsert to a new file, xloginsert.c. >> >> xlog.c is huge, this makes it a little bit smaller, which is nice. Functions >> related to putting together the WAL record are in xloginsert.c, and the >> lower level stuff for managing WAL buffers and such are in xlog.c. >> >> Also move the definition of XLogRecord to a separate header file. This >> causes churn in the #includes of all the files that write WAL records, and >> redo routines, but it avoids pulling in xlog.h into most places. > > This commit broke the WAL_DEBUG case: > > /pgsql/source/brin/src/backend/access/transam/xlog.c: In function 'XLogInsertRecord': > /pgsql/source/brin/src/backend/access/transam/xlog.c:1073:4: error: 'rdt_lastnormal' undeclared (first use in this function) > rdt_lastnormal->next = NULL; > ^ Sorry, fixed. - Heikki