Database Reference
In-Depth Information
It's tempting to banish checkpoints as much as possible by setting the following parameters:
checkpoint_segments = 1000
checkpoint_timeout = 3600
though if you do you might give some thought to how long the recovery will be if you do and
whether you want that.
Also, you should make sure that the pg_xlog directory is mounted on disks with enough disk
space for at least 3 x 16 MB x checkpoint_segments. Put another way, you need at least 32
GB of disk space for checkpoint_segments = 1000 . If wal_keep_segments > 0 then the
server can also use up to 16MB x (wal_keep_segments + checkpoint_segments).
How it works...
Recovery continues until the end of the transaction log. We are writing this continually,
so there is no defined end point; it is literally the last correct record. Each WAL record is
individually CRC checked, so we know whether a record is complete and valid before trying to
process it. Each record contains a pointer to the previous record, so we can tell that the record
forms a valid link in the chain of actions recorded in WAL. As a result of that, recovery always
ends with some kind of error reading the next WAL record. That is normal.
Recovery performance can be very fast, though it does depend upon the actions being
recovered. The best way to test recovery performance is to setup a standby replication server,
described in the chapter on Replication .
There's more...
It's possible for a problem to be caused replaying the transaction log, and for the database
server to fail to start.
Some people's response to this is to use a utility named pg_resetxlog , which removes the
current transaction log files and tidies up after that surgery has taken place.
pg_resetxlog destroys data changes and that means data loss . If you do decide to run that
utility, make sure you take a backup of the pg_xlog directory first. My advice is to seek
immediate assistance rather than do this. You don't know for certain that doing this will fix a
problem, though once you've done it, you will have difficulty going backwards.
 
Search WWH ::




Custom Search