aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
Commit message (Collapse)AuthorAge
...
* Minor changes to recovery pause behaviour.Simon Riggs2011-03-23
| | | | | | | | | Change location LOG message so it works each time we pause, not just for final pause. Ensure that we pause only if we are in Hot Standby and can connect to allow us to run resume function. This change supercedes the code to override parameter recoveryPauseAtTarget to false if not attempting to enter Hot Standby, which is now removed.
* Prevent intermittent hang in recovery from bgwriter interaction.Simon Riggs2011-03-23
| | | | | | Startup process waited for cleanup lock but when hot_standby = off the pid was not registered, so that the bgwriter would not wake the waiting process as intended.
* When two base backups are started at the same time with pg_basebackup,Heikki Linnakangas2011-03-21
| | | | | | | | ensure that they use different checkpoints as the starting point. We use the checkpoint redo location as a unique identifier for the base backup in the end-of-backup record, and in the backup history file name. Bug spotted by Fujii Masao.
* Remove bogus semicolons in recoveryPausesHere.Robert Haas2011-03-18
| | | | | Without this, the startup process goes into a tight loop, consuming 100% of one CPU and failing to respond to interrupts.
* Clarify C comment that O_SYNC/O_FSYNC are really the same settting, asBruce Momjian2011-03-10
| | | | opposed to O_DSYNC.
* Emit a LOG message when pausing at the recovery target.Robert Haas2011-03-10
| | | | Fujii Masao
* Truncate predicate lock manager's SLRU lazily at checkpoint. That's saferHeikki Linnakangas2011-03-08
| | | | | | | | than doing it aggressively whenever the tail-XID pointer is advanced, because this way we don't need to do it while holding SerializableXactHashLock. This also fixes bug #5915 spotted by YAMAMOTO Takashi, and removes an obsolete comment spotted by Kevin Grittner.
* If recovery_target_timeline is set to 'latest' and standby mode is enabled,Heikki Linnakangas2011-03-07
| | | | | | | | | | | | | | | | | periodically rescan the archive for new timelines, while waiting for new WAL segments to arrive. This allows you to set up a standby server that follows the TLI change if another standby server is promoted to master. Before this, you had to restart the standby server to make it notice the new timeline. This patch only scans the archive for TLI changes, it won't follow a TLI change in streaming replication. That is much needed too, but it would be a much bigger patch than I dare to sneak in this late in the release cycle. There was discussion on improving the sanity checking of the WAL segments so that the system would notice more reliably if the new timeline isn't an ancestor of the current one, but that is not included in this patch. Reviewed by Fujii Masao.
* Named restore point improvements.Robert Haas2011-02-24
| | | | | | | | Emit a log message when creating a named restore point, and improve documentation for pg_create_restore_point(). Euler Taveira de Oliveira, per suggestions from Thom Brown, with some additional wordsmithing by me.
* Hot Standby feedback for avoidance of cleanup conflicts on standby.Simon Riggs2011-02-16
| | | | | | | | | | | | | Standby optionally sends back information about oldestXmin of queries which is then checked and applied to the WALSender's proc->xmin. GetOldestXmin() is modified slightly to agree with GetSnapshotData(), so that all backends on primary include WALSender within their snapshots. Note this does nothing to change the snapshot xmin on either master or standby. Feedback piggybacks on the standby reply message. vacuum_defer_cleanup_age is no longer used on standby, though parameter still exists on primary, since some use cases still exist. Simon Riggs, review comments from Fujii Masao, Heikki Linnakangas, Robert Haas
* pg_ctl promoteRobert Haas2011-02-15
| | | | Fujii Masao, reviewed by Robert Haas, Stephen Frost, and Magnus Hagander.
* PITR can stop at a named restore point when recovery target = timeSimon Riggs2011-02-15
| | | | | | | though must not update the last transaction timestamp. Plus comment and message cleanup for recent named restore point. Fujii Masao, minor changes by me
* Send status updates back from standby server to master, indicating how farHeikki Linnakangas2011-02-10
| | | | | | | | | | the standby has written, flushed, and applied the WAL. At the moment, this is for informational purposes only, the values are only shown in pg_stat_replication system view, but in the future they will also be needed for synchronous replication. Extracted from Simon riggs' synchronous replication patch by Robert Haas, with some tweaking by me.
* Implement NOWAIT option for BASE_BACKUP commandMagnus Hagander2011-02-09
| | | | | | | | | | Specifying this option makes the server not wait for the xlog to be archived, or emit a warning that it can't, instead leaving the responsibility with the client. This is useful when the log is being streamed using the streaming protocol in parallel with the backup, without having log archiving enabled.
* Named restore points in recovery. Users can record named points, thenSimon Riggs2011-02-08
| | | | | | | new recovery.conf parameter recovery_target_name allows PITR to specify named points as recovery targets. Jaime Casanova, reviewed by Euler Taveira de Oliveira, plus minor edits
* Basic Recovery Control functions for use in Hot Standby. Pause, Resume,Simon Riggs2011-02-08
| | | | | | | Status check functions only. Also, new recovery.conf parameter to pause_at_recovery_target, default on. Simon Riggs, reviewed by Fujii Masao
* Remove rare corner case for data loss when triggering standby server.Simon Riggs2011-02-08
| | | | | | | | | | | If the standby was streaming when trigger file arrives, check also in the archive for additional WAL files. This is a corner case since it is unlikely that we would trigger a failover while the master is still available and sending data to standby, while at the same time running in archive mode and also while the streaming standby has fallen behind archive. Someone would eventually be unlucky; we must plug all gaps however small. Fujii Masao
* Log restartpoints in the same fashion as checkpoints.Robert Haas2011-02-02
| | | | | | | | | Prior to 9.0, restartpoints never created, deleted, or recycled WAL files, but now they can. This code makes log_checkpoints treat checkpoints and restartpoints symmetrically. It also adjusts up the documentation of the parameter to mention restartpoints. Fujii Masao. Docs by me, as suggested by Itagaki Takahiro.
* Support multiple concurrent pg_basebackup backups.Heikki Linnakangas2011-01-31
| | | | | | | | | With this patch, pg_basebackup doesn't write a backup_label file in the data directory, so it doesn't interfere with a pg_start/stop_backup() based backup anymore. backup_label is still included in the backup, but it is injected directly into the tar stream. Heikki Linnakangas, reviewed by Fujii Masao and Magnus Hagander.
* Allow the wal_buffers setting to be auto-tuned to a reasonable value.Tom Lane2011-01-22
| | | | | | | | | If wal_buffers is initially set to -1 (which is now the default), it's replaced by 1/32nd of shared_buffers, with a minimum of 8 (the old default) and a maximum of the XLOG segment size. The allowed range for manual settings is still from 4 up to whatever will fit in shared memory. Greg Smith, with implementation correction by me.
* Split pg_start_backup() and pg_stop_backup() into two piecesMagnus Hagander2011-01-09
| | | | | | | | | | Move the actual functionality into a separate function that's easier to call internally, and change the SQL-callable function to be a wrapper calling this. Also create a pg_abort_backup() function, only callable internally, that does only the most vital parts of pg_stop_backup(), making it safe(r) to call from error handlers.
* Stamp copyrights for year 2011.Bruce Momjian2011-01-01
|
* Support unlogged tables.Robert Haas2010-12-29
| | | | | | | The contents of an unlogged table are WAL-logged; thus, they are not available on standby servers and are truncated whenever the database system enters recovery. Indexes on unlogged tables are also unlogged. Unlogged GiST indexes are not currently supported.
* Add REPLICATION privilege for ROLEsMagnus Hagander2010-12-29
| | | | | | | | | | | This privilege is required to do Streaming Replication, instead of superuser, making it possible to set up a SR slave that doesn't have write permissions on the master. Superuser privileges do NOT override this check, so in order to use the default superuser account for replication it must be explicitly granted the REPLICATION permissions. This is backwards incompatible change, in the interest of higher default security.
* Instrument checkpoint sync calls.Robert Haas2010-12-14
| | | | Greg Smith, reviewed by Jeff Janes
* Use symbolic names not octal constants for file permission flags.Tom Lane2010-12-10
| | | | | | | | Purely cosmetic patch to make our coding standards more consistent --- we were doing symbolic some places and octal other places. This patch fixes all C-coded uses of mkdir, chmod, and umask. There might be some other calls I missed. Inconsistency noted while researching tablespace directory permissions issue.
* Fix bugs in the hot standby known-assigned-xids tracking logic. If there'sHeikki Linnakangas2010-12-07
| | | | | | | | | | | | | | | | | | | | | | | an old transaction running in the master, and a lot of transactions have started and finished since, and a WAL-record is written in the gap between the creating the running-xacts snapshot and WAL-logging it, recovery will fail with "too many KnownAssignedXids" error. This bug was reported by Joachim Wieland on Nov 19th. In the same scenario, when fewer transactions have started so that all the xids fit in KnownAssignedXids despite the first bug, a more serious bug arises. We incorrectly initialize the clog code with the oldest still running transaction, and when we see the WAL record belonging to a transaction with an XID larger than one that committed already before the checkpoint we're recovering from, we zero the clog page containing the already committed transaction, leading to data loss. In hindsight, trying to track xids in the known-assigned-xids array before seeing the running-xacts record was too complicated. To fix that, hold XidGenLock while the running-xacts snapshot is taken and WAL-logged. That ensures that no transaction can begin or end in that gap, so that in recvoery we know that the snapshot contains all transactions running at that point in WAL.
* Fix two typos, by Fujii Masao.Heikki Linnakangas2010-12-06
|
* Use GUC lexer for recovery.conf parsing.Robert Haas2010-12-03
| | | | | | | | This eliminates some crufty, special-purpose code and, as a non-trivial side benefit, allows recovery.conf parameters to be unquoted. Dimitri Fontaine, with review and cleanup by Alvaro Herrera, Itagaki Takahiro, and me.
* Remove useless whitespace at end of linesPeter Eisentraut2010-11-23
|
* Fix bug introduced by the recent patch to check that the checkpoint redoHeikki Linnakangas2010-11-11
| | | | | | | location read from backup label file can be found: wasShutdown was set incorrectly when a backup label file was found. Jeff Davis, with a little tweaking by me.
* Add monitoring function pg_last_xact_replay_timestamp.Robert Haas2010-11-09
| | | | Fujii Masao, with a little wordsmithing by me.
* Bootstrap WAL to begin at segment logid=0 logseg=1 (000000010000000000000001)Heikki Linnakangas2010-11-02
| | | | | | | | | | | | | rather than 0/0, so that we can safely use 0/0 as an invalid value. This is a more future-proof fix for the corner-case bug in streaming replication that was fixed yesterday. We had a similar corner-case bug with log/seg 0/0 back in February as well. Avoiding 0/0 as a valid value should prevent bugs like that in the future. Per Tom Lane's idea. Back-patch to 9.0. Since this only affects bootstrapping, it makes no difference to existing installations. We don't need to worry about the bug in existing installations, because if you've managed to get past the initial base backup already, you won't hit the bug in the future either.
* Fix corner-case bug in tracking of latest removed WAL segment duringHeikki Linnakangas2010-11-01
| | | | | | | | | streaming replication. We used log/seg 0/0 to indicate that no WAL segments have been removed since startup, but 0/0 is a valid value for the very first WAL segment after initdb. To make that disambiguous, store (latest removed WAL segment + 1) in the global variable. Per report from Matt Chesler, also reproduced by Greg Smith.
* Before removing backup_label and irrevocably changing pg_control file, checkHeikki Linnakangas2010-10-26
| | | | | | | | that WAL file containing the checkpoint redo-location can be found. This avoids making the cluster irrecoverable if the redo location is in an earlie WAL file than the checkpoint record. Report, analysis and patch by Jeff Davis, with small changes by me.
* Make startup process respond to signals to cancel waiting on latch.Simon Riggs2010-10-14
| | | | | | A tidy up for recently committed changes to startup latch. Fujii Masao
* Fix bug in comment of timeline history file.Simon Riggs2010-10-14
| | | | Fujii Masao
* Remove cvs keywords from all files.Magnus Hagander2010-09-20
|
* Fix two typos in comments, spotted by Fujii Masao and Thom BrownHeikki Linnakangas2010-09-15
|
* Use a latch to make startup process wake up and replay immediately whenHeikki Linnakangas2010-09-15
| | | | | | | | | | new WAL arrives via streaming replication. This reduces the latency, and also allows us to use a longer polling interval, which is good for energy efficiency. We still need to poll to check for the appearance of a trigger file, but the interval is now 5 seconds (instead of 100ms), like when waiting for a new WAL segment to appear in WAL archive.
* Fix misleading DEBUG2 issued during RemoveOldXlogFiles()Simon Riggs2010-08-30
|
* Truncate subtrans after each restartpoint.Simon Riggs2010-08-30
| | | | Issue reported by Harald Kolb, patch by Fujii Masao, review by me.
* Remove duplicate translatable phraseAlvaro Herrera2010-08-26
|
* Rename asyncCommitLSN to asyncXactLSN to reflect changed role in 9.0.Simon Riggs2010-07-29
| | | | | | Transaction aborts now record their LSN to avoid corner case behaviour in SR/HS, hence change of name of variables and functions. As pointed out by Fujii Masao. Cosmetic changes only.
* pgindent run for 9.0, second runBruce Momjian2010-07-06
|
* Don't set recoveryLastXTime when replaying a checkpoint --- that was a bogusTom Lane2010-07-03
| | | | | | | | idea from the start since the variable is only meant to track commit/abort events. This patch reverts the logic around the variable to what it was in 8.4, except that the value is now kept in shared memory rather than a static variable, so that it can be reported correctly by CreateRestartPoint (which is executed in the bgwriter).
* Replace max_standby_delay with two parameters, max_standby_archive_delay andTom Lane2010-07-03
| | | | | | | | | | | | | | max_standby_streaming_delay, and revise the implementation to avoid assuming that timestamps found in WAL records can meaningfully be compared to clock time on the standby server. Instead, the delay limits are compared to the elapsed time since we last obtained a new WAL segment from archive or since we were last "caught up" to WAL data arriving via streaming replication. This avoids problems with clock skew between primary and standby, as well as other corner cases that the original coding would misbehave in, such as the primary server having significant idle time between transactions. Per my complaint some time ago and considerable ensuing discussion. Do some desultory editing on the hot standby documentation, too.
* emode_for_corrupt_record shouldn't reduce LOG messages to WARNING.Robert Haas2010-06-28
| | | | In non-interactive sessions, WARNING sorts below LOG.
* Make RemoveOldXlogFiles's debug printout match style used elsewhere:Tom Lane2010-06-17
| | | | | log and seg aren't an XLogRecPtr and shouldn't be printed like one. Fujii Masao
* Don't allow walsender to send WAL data until it's been safely fsync'd on theTom Lane2010-06-17
| | | | | | | | master. Otherwise a subsequent crash could cause the master to lose WAL that has already been applied on the slave, resulting in the slave being out of sync and soon corrupt. Per recent discussion and an example from Robert Haas. Fujii Masao