Full page images in WAL & Cache Invalidation - Mailing list pgsql-hackers

From Florian G. Pflug
Subject Full page images in WAL & Cache Invalidation
Date
Msg-id 46A37DA5.3080808@phlo.org
Whole thread Raw
Responses Re: Full page images in WAL & Cache Invalidation  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Full page images in WAL & Cache Invalidation  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Full page images in WAL & Cache Invalidation  ("Simon Riggs" <simon@2ndquadrant.com>)
List pgsql-hackers
Hi

I'm currently working on correctly flushing the
catalog/relation/sgmr caches on a readonly PITR
slave during recovery. These are the things that
currently cause me headache.

1) It seems that the btree code sends out relcache   invalidation msgs during normal operation   (No DDL statements are
executed).This lets any   simple flush-all-caches-if-ddl-was-execute scheme   fail.
 

2) When a full page image is written to the wal, the   information about what tuple was updated is lost.   So
synthesizingcache invalidation msgs from the   WAL records would need to reverseengineer a full   page image, which
seemshard and errorprone.
 

3) Most cache invalidations seem to be generated by   heap_insert (via PrepareForTupleInvalidation). Those   seems to
bereconstructable from the WAL quite easily.   Those sent out via CacheInvalidateRelcache*, however,   seem to leave no
tracein the WAL.
 

What I'm wondering is how much performance is lost if
I just let the slave flush all it's caches whenever it
replayed a commit record of a transaction that executed
DDL. To me it looks like that would only seriously harm
performance if a lot of temporary tables are created on
the master. Since there seem to be quite people who are
unhappiy about the current temptable implementation,
optimizing for that case might prove worthless if 8.4 or
8.5 will change the way that temptables are handled.

If this brute-force approach turns out to perform really
bad, does anyone see an elegant way around (2) and (3)?
(2) seems solveable by writing logical and physical records
to the wal - similar to what that xlog compression idea
needs (I, however, lost track of what came out of that
discussion). But (3) seems to be messy..

greetings, Florian Pflug



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: 8.2 is 30% better in pgbench than 8.3
Next
From: Tom Lane
Date:
Subject: Re: Full page images in WAL & Cache Invalidation