summaryrefslogtreecommitdiff
path: root/src/backend/access/transam
AgeCommit message (Collapse)Author
2010-08-13Include the backend ID in the relpath of temporary relations.Robert Haas
This allows us to reliably remove all leftover temporary relation files on cluster startup without reference to system catalogs or WAL; therefore, we no longer include temporary relations in XLOG_XACT_COMMIT and XLOG_XACT_ABORT WAL records. Since these changes require including a backend ID in each SharedInvalSmgrMsg, the size of the SharedInvalidationMessage.id field has been reduced from two bytes to one, and the maximum number of connections has been reduced from INT_MAX / 4 to 2^23-1. It would be possible to remove these restrictions by increasing the size of SharedInvalidationMessage by 4 bytes, but right now that doesn't seem like a good trade-off. Review by Jaime Casanova and Tom Lane.
2010-08-13Make RecordTransactionCommit() respect wal_level.Robert Haas
Since the only purpose of WAL-loggin SharedInvalidationMessages is to support Hot Standby operation, they needn't be included when wal_level < hot_standby. Back-patch to 9.0. Review by Heikki Linnakanagas and Fujii Masao.
2010-08-12Correct sundry errors in Hot Standby-related comments.Robert Haas
Fujii Masao
2010-07-29Rename asyncCommitLSN to asyncXactLSN to reflect changed role in 9.0.Simon Riggs
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.
2010-07-23Avoid deep recursion when assigning XIDs to multiple levels of subxacts.Robert Haas
Backpatch to 8.0. Andres Freund, with cleanup and adjustment for older branches by me.
2010-07-08Update obsolete comment. Noted by Josh Tolley.Tom Lane
2010-07-06pgindent run for 9.0, second runBruce Momjian
2010-07-03Don't set recoveryLastXTime when replaying a checkpoint --- that was a bogusTom Lane
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).
2010-07-03Replace max_standby_delay with two parameters, max_standby_archive_delay andTom Lane
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.
2010-06-29Add C comment about why synchronous_commit=off behavior can loseBruce Momjian
committed transactions in a postmaster crash.
2010-06-28emode_for_corrupt_record shouldn't reduce LOG messages to WARNING.Robert Haas
In non-interactive sessions, WARNING sorts below LOG.
2010-06-17Make RemoveOldXlogFiles's debug printout match style used elsewhere:Tom Lane
log and seg aren't an XLogRecPtr and shouldn't be printed like one. Fujii Masao
2010-06-17Don't allow walsender to send WAL data until it's been safely fsync'd on theTom Lane
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
2010-06-14If a corrupt WAL record is received by streaming replication, disconnectHeikki Linnakangas
and retry. If the record is genuinely corrupt in the master database, there's little hope of recovering, but it's better than simply retrying to apply the corrupt WAL record in a tight loop without even trying to retransmit it, which is what we used to do.
2010-06-12Fix typo/bug, found by Clang compilerPeter Eisentraut
2010-06-10Rename restartpoint_command to archive_cleanup_command.Itagaki Takahiro
2010-06-10Make TriggerFile variable static. It's not used outside xlog.c.Heikki Linnakangas
Fujii Masao
2010-06-10Return NULL instead of 0/0 in pg_last_xlog_receive_location() andHeikki Linnakangas
pg_last_xlog_replay_location(). Per Robert Haas's suggestion, after Itagaki Takahiro pointed out an issue in the docs. Also, some wording changes in the docs by me.
2010-06-09In standby mode, respect checkpoint_segments in addition toHeikki Linnakangas
checkpoint_timeout to trigger restartpoints. We used to deliberately only do time-based restartpoints, because if checkpoint_segments is small we would spend time doing restartpoints more often than really necessary. But now that restartpoints are done in bgwriter, they're not as disruptive as they used to be. Secondly, because streaming replication stores the streamed WAL files in pg_xlog, we want to clean it up more often to avoid running out of disk space when checkpoint_timeout is large and checkpoint_segments small. Patch by Fujii Masao, with some minor changes by me.
2010-06-09Make the walwriter close it's handle to an old xlog segment if it's no longerMagnus Hagander
the current one. Not doing this would leave the walwriter with a handle to a deleted file if there was nothing for it to do for a long period of time, preventing the file from being completely removed. Reported by Tollef Fog Heen, and thanks to Heikki for some hand-holding with the patch.
2010-06-03Fix some inconsistent quoting of wal_level values in messagesPeter Eisentraut
When referring to postgresql.conf syntax, then it's without quotes (wal_level=archive); in narrative it's with double quotes. But never single quotes.
2010-06-03On clean shutdown during recovery, don't warn about possible corruption.Robert Haas
Fujii Masao. Review by Heikki Linnakangas and myself.
2010-06-02Fix obsolete comments that I neglected to update in a previous patch.Heikki Linnakangas
Fujii Masao
2010-05-27Adjust comment to reflect that we now have Hot Standby. Pointed out byHeikki Linnakangas
Robert Haas.
2010-05-15Rename PM_RECOVERY_CONSISTENT and PMSIGNAL_RECOVERY_CONSISTENT.Robert Haas
The new names PM_HOT_STANDBY and PMSIGNAL_BEGIN_HOT_STANDBY more accurately reflect their actual function.
2010-05-15Fix bug in processing of checkpoint time for max_standby_delay. LatestSimon Riggs
log time was incorrectly set, typically leading to dates in the past, which would cause more cancellations in Hot Standby on a quiet server.
2010-05-14Add many new Asserts in code and fix simple bug that slipped throughSimon Riggs
without them, related to previous commit. Report by Bruce Momjian.
2010-05-13Ensure that top level aborts call XLogSetAsyncCommit(). Not doingSimon Riggs
so simply leads to data waiting in wal_buffers which then causes later commits to potentially do emergency writes and for all forms of replication to be potentially delayed without need or benefit. Issue pointed out exactly by Fujii Masao, following bug report by Robert Haas on a separate though related topic.
2010-05-13Cleanup initialization of Hot Standby. Clarify working with reanalysisSimon Riggs
of requirements and documentation on LogStandbySnapshot(). Fixes two minor bugs reported by Tom Lane that would lead to an incorrect snapshot after transaction wraparound. Also fix two other problems discovered that would give incorrect snapshots in certain cases. ProcArrayApplyRecoveryInfo() substantially rewritten. Some minor refactoring of xact_redo_apply() and ExpireTreeKnownAssignedTransactionIds().
2010-05-03Need to hold ControlFileLock while updating control file. UpdateHeikki Linnakangas
minRecoveryPoint in control file when replaying a parameter change record, to ensure that we don't allow hot standby on WAL generated without wal_level='hot_standby' after a standby restart.
2010-05-02Clean up some awkward, inaccurate, and inefficient processing aroundTom Lane
MaxStandbyDelay. Use the GUC units mechanism for the value, and choose more appropriate timestamp functions for performing tests with it. Make the ps_activity manipulation in ResolveRecoveryConflictWithVirtualXIDs have behavior similar to ps_activity code elsewhere, notably not updating the display when update_process_title is off and not truncating the display contents at an arbitrarily-chosen length. Improve the docs to be explicit about what MaxStandbyDelay actually measures, viz the difference between primary and standby servers' clocks, and the possible hazards if their clocks aren't in sync.
2010-04-29Adjust error checks in pg_start_backup and pg_stop_backup to make it possibleTom Lane
to perform a backup without archive_mode being enabled. This gives up some user-error protection in order to improve usefulness for streaming-replication scenarios. Per discussion.
2010-04-29Rename the parameter recovery_connections to hot_standby, to reduce possibleTom Lane
confusion with streaming-replication settings. Also, change its default value to "off", because of concern about executing new and poorly-tested code during ordinary non-replicating operation. Per discussion. In passing do some minor editing of related documentation.
2010-04-28Modify ShmemInitStruct and ShmemInitHash to throw errors internally,Tom Lane
rather than returning NULL for some-but-not-all failures as they used to. Remove now-redundant tests for NULL from call sites. We had to do something about this because many call sites were failing to check for NULL; and changing it like this seems a lot more useful and mistake-proof than adding checks to the call sites without them.
2010-04-28Introduce wal_level GUC to explicitly control if information needed forHeikki Linnakangas
archival or hot standby should be WAL-logged, instead of deducing that from other options like archive_mode. This replaces recovery_connections GUC in the primary, where it now has no effect, but it's still used in the standby to enable/disable hot standby. Remove the WAL-logging of "unlogged operations", like creating an index without WAL-logging and fsyncing it at the end. Instead, we keep a copy of the wal_mode setting and the settings that affect how much shared memory a hot standby server needs to track master transactions (max_connections, max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings change, at server restart, write a WAL record noting the new settings and update pg_control. This allows us to notice the change in those settings in the standby at the right moment, they used to be included in checkpoint records, but that meant that a changed value was not reflected in the standby until the first checkpoint after the change. Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to the sequence it used to follow, before hot standby and subsequent patches changed it to 0x9003.
2010-04-28Replace the KnownAssignedXids hash table with a sorted-array data structure,Tom Lane
and be more tense about the locking requirements for it, to improve performance in Hot Standby mode. In passing fix a few bugs and improve a number of comments in the existing HS code. Simon Riggs, with some editorialization by Tom
2010-04-27If a base backup is cancelled by server shutdown or crash, throw an errorHeikki Linnakangas
in WAL recovery when it sees the shutdown checkpoint record. It's more user-friendly to find out about it at that point than at the end of recovery, and you're not left wondering why your hot standby server never opens up for read-only connections.
2010-04-23Previous patch revoked following objections.Simon Riggs
2010-04-23Make CheckRequiredParameterValues() depend upon correct combinationSimon Riggs
of parameters. Fix bug report by Robert Haas that error message and hint was incorrect if wrong mode parameters specified on master. Internal changes only. Proposals for parameter simplification on master/primary still under way.
2010-04-20Rename standby_keep_segments to wal_keep_segments.Robert Haas
Also, make the name of the GUC and the name of the backing variable match. Alnong the way, clean up a couple of slight typographical errors in the related docs.
2010-04-18Improve sequence and sense of messages from pg_stop_backup().Simon Riggs
Now doesn't report it is waiting until it actually is waiting, plus message doesn't appear until at least 5 seconds wait, so we avoid reporting the wait before we've given the archiver a reasonable time to wake up and archive the file we just created earlier in the function. Also add new unconditional message to confirm safe completion. Now a normal, healthy execution does not report waiting at all, just safe completion.
2010-04-18Remove some additional changes in previous commit that belong elsewhere.Simon Riggs
2010-04-18Tune GetSnapshotData() during Hot Standby by avoiding loopSimon Riggs
through normal backends. Makes code clearer also, since we avoid various Assert()s. Performance of snapshots taken during recovery no longer depends upon number of read-only backends.
2010-04-16In standby mode, suppress repeated LOG messages about a corrupt record,Heikki Linnakangas
which just indicates that we've reached the end of valid WAL found in the standby.
2010-04-15Doc change: effect -> affect, per Robert HaasBruce Momjian
2010-04-14Fix minor typo in comment in xlog.cSimon Riggs
2010-04-13Allow Hot Standby to begin from a shutdown checkpoint.Heikki Linnakangas
Patch by Simon Riggs & me
2010-04-12Update the location of last removed WAL segment in shared memory onlyHeikki Linnakangas
after actually removing one, so that if we can't remove segments because WAL archiving is lagging behind, we don't unnecessarily forbid streaming the old not-yet-archived segments that are still perfectly valid. Per suggestion from Fujii Masao.
2010-04-12Change the logic to decide when to delete old WAL segments, so that itHeikki Linnakangas
doesn't take into account how far the WAL senders are. This way a hung WAL sender doesn't prevent old WAL segments from being recycled/removed in the primary, ultimately causing the disk to fill up. Instead add standby_keep_segments setting to control how many old WAL segments are kept in the primary. This also makes it more reliable to use streaming replication without WAL archiving, assuming that you set standby_keep_segments high enough.
2010-04-07Allow quotes to be escaped in recovery.conf, by doubling them. This patchHeikki Linnakangas
also makes the parsing a little bit stricter, rejecting garbage after the parameter value and values with missing ending quotes, for example.