pgsql: Move log_newpage and log_newpage_buffer to xlog.c.

Started by Heikki Linnakangasover 11 years ago6 messages
#1Heikki Linnakangas
heikki.linnakangas@iki.fi

Move log_newpage and log_newpage_buffer to xlog.c.

log_newpage is used by many indexams, in addition to heap, but for
historical reasons it's always been part of the heapam rmgr. Starting with
9.3, we have another WAL record type for logging an image of a page,
XLOG_FPI. Simplify things by moving log_newpage and log_newpage_buffer to
xlog.c, and switch to using the XLOG_FPI record type.

Bump the WAL version number because the code to replay the old HEAP_NEWPAGE
records is removed.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/54685338e37889eebd473804c3feb006dd83a882

Modified Files
--------------
src/backend/access/gin/gindatapage.c | 1 -
src/backend/access/gin/gininsert.c | 1 -
src/backend/access/gin/ginxlog.c | 3 +-
src/backend/access/gist/gist.c | 1 -
src/backend/access/heap/heapam.c | 180 ------------------------------
src/backend/access/nbtree/nbtree.c | 1 -
src/backend/access/nbtree/nbtsort.c | 1 -
src/backend/access/rmgrdesc/heapdesc.c | 9 --
src/backend/access/spgist/spginsert.c | 1 -
src/backend/access/transam/xlog.c | 131 +++++++++++++++++++++-
src/backend/commands/tablecmds.c | 1 -
src/backend/replication/logical/decode.c | 8 --
src/include/access/heapam_xlog.h | 19 +---
src/include/access/xlog.h | 5 +
src/include/access/xlog_internal.h | 2 +-
15 files changed, 139 insertions(+), 225 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2Simon Riggs
simon@2ndQuadrant.com
In reply to: Heikki Linnakangas (#1)
Re: pgsql: Move log_newpage and log_newpage_buffer to xlog.c.

On 31 July 2014 14:59, Heikki Linnakangas <heikki.linnakangas@iki.fi> wrote:

Move log_newpage and log_newpage_buffer to xlog.c.

Got a feeling this wasn't properly discussed because its unlikely
anybody would agree with adding more stuff to xlog.c

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#3Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Simon Riggs (#2)
Re: [COMMITTERS] pgsql: Move log_newpage and log_newpage_buffer to xlog.c.

On 07/31/2014 05:19 PM, Simon Riggs wrote:

On 31 July 2014 14:59, Heikki Linnakangas <heikki.linnakangas@iki.fi> wrote:

Move log_newpage and log_newpage_buffer to xlog.c.

Got a feeling this wasn't properly discussed because its unlikely
anybody would agree with adding more stuff to xlog.c

Well, they certainly don't belong in heapam.c... Got a better suggestion?

(I bumped into this again while working on the WAL format & API changes,
which understandably rewrites those functions again. It seemed better to
do this refactoring separately than include it in the huge patch.)

- Heikki

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Simon Riggs
simon@2ndQuadrant.com
In reply to: Heikki Linnakangas (#3)
Re: [COMMITTERS] pgsql: Move log_newpage and log_newpage_buffer to xlog.c.

On 31 July 2014 15:48, Heikki Linnakangas <hlinnaka@iki.fi> wrote:

On 07/31/2014 05:19 PM, Simon Riggs wrote:

On 31 July 2014 14:59, Heikki Linnakangas <heikki.linnakangas@iki.fi>
wrote:

Move log_newpage and log_newpage_buffer to xlog.c.

Got a feeling this wasn't properly discussed because its unlikely
anybody would agree with adding more stuff to xlog.c

Well, they certainly don't belong in heapam.c... Got a better suggestion?

I guess if we had xlog_fpi.c with RestoreBackupBlock et all, plus the
stuff you just moved it might make sense.

Just looking for ways to prune it down.

(I bumped into this again while working on the WAL format & API changes,
which understandably rewrites those functions again. It seemed better to do
this refactoring separately than include it in the huge patch.)

Yeh, no problem with the refactoring itself, but I wanted to remind
you to discuss stuff.

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Heikki Linnakangas
hlinnakangas@vmware.com
In reply to: Simon Riggs (#4)
Re: [COMMITTERS] pgsql: Move log_newpage and log_newpage_buffer to xlog.c.

On 07/31/2014 05:58 PM, Simon Riggs wrote:

On 31 July 2014 15:48, Heikki Linnakangas <hlinnaka@iki.fi> wrote:

On 07/31/2014 05:19 PM, Simon Riggs wrote:

On 31 July 2014 14:59, Heikki Linnakangas <heikki.linnakangas@iki.fi>
wrote:

Move log_newpage and log_newpage_buffer to xlog.c.

Got a feeling this wasn't properly discussed because its unlikely
anybody would agree with adding more stuff to xlog.c

Well, they certainly don't belong in heapam.c... Got a better suggestion?

I guess if we had xlog_fpi.c with RestoreBackupBlock et all, plus the
stuff you just moved it might make sense.

Just looking for ways to prune it down.

Yeah, something like that might make sense. I totally agree that xlog.c
is huge (although so is heapam.c). In the WAL format & API patch, I'm
putting much of the new code for constructing a WAL record into a new
file, xlogconstruct.c (in the latest version I'm just about to post -
the previous version put them all in xlog.c).

(I bumped into this again while working on the WAL format & API changes,
which understandably rewrites those functions again. It seemed better to do
this refactoring separately than include it in the huge patch.)

Yeh, no problem with the refactoring itself, but I wanted to remind
you to discuss stuff.

Ok, thanks. I did post to pgsql-hackers first, see
/messages/by-id/53DA0ECF.4040002@vmware.com.
Admittedly I didn't leave much time for discussion between the post and
commit; that was because I felt quite certain that people wouldn't
object to this.

- Heikki

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6Robert Haas
robertmhaas@gmail.com
In reply to: Heikki Linnakangas (#5)
Re: [COMMITTERS] pgsql: Move log_newpage and log_newpage_buffer to xlog.c.

On Thu, Jul 31, 2014 at 11:07 AM, Heikki Linnakangas
<hlinnakangas@vmware.com> wrote:

Ok, thanks. I did post to pgsql-hackers first, see
/messages/by-id/53DA0ECF.4040002@vmware.com. Admittedly
I didn't leave much time for discussion between the post and commit; that
was because I felt quite certain that people wouldn't object to this.

I think it's generally a good idea to leave 24 hours anyway, maybe a
bit more over a weekend.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers