summaryrefslogtreecommitdiff
path: root/src/backend/access/transam
AgeCommit message (Collapse)Author
2004-11-17Minor adjustment of message style.Tom Lane
2004-11-17Don't allow pg_start_backup() to be invoked if archive_command has notNeil Conway
been defined. Patch from Gavin Sherry, editorializing by Neil Conway.
2004-11-05Small message clarificationsPeter Eisentraut
2004-10-30Change COMMIT back to the old behavior of emitting command tag COMMIT,Tom Lane
not ROLLBACK, for the case of COMMIT outside a transaction block. Alvaro Herrera
2004-10-29Rearrange order of pre-commit operations: must close cursors before doingTom Lane
ON COMMIT actions. Per bug report from Michael Guerin.
2004-10-29Add DEBUG1-level logging of checkpoint start and end. Also, reduce theTom Lane
'recycled log files' and 'removed log files' messages from DEBUG1 to DEBUG2, replacing them with a count of files added/removed/recycled in the checkpoint end message, as per suggestion from Simon Riggs.
2004-10-16Give the ResourceOwner mechanism full responsibility for releasing bufferTom Lane
pins at end of transaction, and reduce AtEOXact_Buffers to an Assert cross-check that this was done correctly. When not USE_ASSERT_CHECKING, AtEOXact_Buffers is a complete no-op. This gets rid of an O(NBuffers) bottleneck during transaction commit/abort, which recent testing has shown becomes significant above a few tens of thousands of shared buffers.
2004-10-14Add 'int' cast for getpid() because some Solaris releases return longBruce Momjian
for getpid().
2004-10-12Message style revisionsPeter Eisentraut
2004-10-09Make getpid() use %d consistently for printing.Bruce Momjian
2004-10-07Adjust comments previously moved to column 1 by pgident.Bruce Momjian
2004-10-04PortalRun must guard against the possibility that the portal it'sTom Lane
running contains VACUUM or a similar command that will internally start and commit transactions. In such a case, the original caller values of CurrentMemoryContext and CurrentResourceOwner will point to objects that will be destroyed by the internal commit. We must restore these pointers to point to the newly-manufactured transaction context and resource owner, rather than possibly pointing to deleted memory. Also tweak xact.c so that AbortTransaction and AbortSubTransaction forcibly restore a sane value for CurrentResourceOwner, much as they have always done for CurrentMemoryContext. I'm not certain this is necessary but I'm feeling paranoid today. Responds to Sean Chittenden's bug report of 4-Oct.
2004-09-16Add some marginal tweaks to eliminate memory leakages associated withTom Lane
subtransactions. Trivial subxacts (such as a plpgsql exception block containing no database access) now demonstrably leak zero bytes.
2004-09-16RecentXmin is too recent to use as the cutoff point for accessingTom Lane
pg_subtrans --- what we need is the oldest xmin of any snapshot in use in the current top transaction. Introduce a new variable TransactionXmin to play this role. Fixes intermittent regression failure reported by Neil Conway.
2004-09-16Restructure subtransaction handling to reduce resource consumption,Tom Lane
as per recent discussions. Invent SubTransactionIds that are managed like CommandIds (ie, counter is reset at start of each top transaction), and use these instead of TransactionIds to keep track of subtransaction status in those modules that need it. This means that a subtransaction does not need an XID unless it actually inserts/modifies rows in the database. Accordingly, don't assign it an XID nor take a lock on the XID until it tries to do that. This saves a lot of overhead for subtransactions that are only used for error recovery (eg plpgsql exceptions). Also, arrange to release a subtransaction's XID lock as soon as the subtransaction exits, in both the commit and abort cases. This avoids holding many unique locks after a long series of subtransactions. The price is some additional overhead in XactLockTableWait, but that seems acceptable. Finally, restructure the state machine in xact.c to have a more orthogonal set of states for subtransactions.
2004-09-13Redesign query-snapshot timing so that volatile functions in READ COMMITTEDTom Lane
mode see a fresh snapshot for each command in the function, rather than using the latest interactive command's snapshot. Also, suppress fresh snapshots as well as CommandCounterIncrement inside STABLE and IMMUTABLE functions, instead using the snapshot taken for the most closely nested regular query. (This behavior is only sane for read-only functions, so the patch also enforces that such functions contain only SELECT commands.) As per my proposal of 6-Sep-2004; I note that I floated essentially the same proposal on 19-Jun-2002, but that discussion tailed off without any action. Since 8.0 seems like the right place to be taking possibly nontrivial backwards compatibility hits, let's get it done now.
2004-09-10Fire non-deferred AFTER triggers immediately upon query completion,Tom Lane
rather than when returning to the idle loop. This makes no particular difference for interactively-issued queries, but it makes a big difference for queries issued within functions: trigger execution now occurs before the calling function is allowed to proceed. This responds to numerous complaints about nonintuitive behavior of foreign key checking, such as http://archives.postgresql.org/pgsql-bugs/2004-09/msg00020.php, and appears to be required by the SQL99 spec. Also take the opportunity to simplify the data structures used for the pending-trigger list, rename them for more clarity, and squeeze out a bit of space.
2004-09-06Fix incorrect ordering of smgr cleanup relative to buffer pin cleanupTom Lane
during transaction abort. Add a regression test case to catch related mistakes in future. Alvaro Herrera and Tom Lane.
2004-09-06Downgrade LOG messages to DEBUG1 for normal recycling of xlog, clog,Tom Lane
subtrans segments. Per Greg Mullane and Chris K-L.
2004-08-30Ensure that the remainder of the current pg_clog page is zeroed duringTom Lane
startup, just to be sure that there's no leftover junk there.
2004-08-30Fix failure to advance nextXID beyond subtransactions whose XIDs appearTom Lane
only within COMMIT or ABORT records.
2004-08-30Another pgindent run with lib typedefs added.Bruce Momjian
2004-08-29Add WAL logging for CREATE/DROP DATABASE and CREATE/DROP TABLESPACE.Tom Lane
Fix TablespaceCreateDbspace() to be able to create a dummy directory in place of a dropped tablespace's symlink. This eliminates the open problem of a PANIC during WAL replay when a replayed action attempts to touch a file in a since-deleted tablespace. It also makes for a significant improvement in the usability of PITR replay.
2004-08-29Widen xl_len field of XLogRecord header to 32 bits, so that we'll haveTom Lane
a more tolerable limit on the number of subtransactions or deleted files in COMMIT and ABORT records. Buy back the extra space by eliminating the xl_xact_prev field, which isn't being used for anything and is rather unlikely ever to be used for anything. This does not force initdb, but you do need to do pg_resetxlog if you want to upgrade an existing 8.0 installation without initdb.
2004-08-29Pgindent run for 8.0.Bruce Momjian
2004-08-29Update copyright to 2004.Bruce Momjian
2004-08-28Now that TransactionIdDidAbort doesn't think it should try to modifyTom Lane
pg_clog, there's no reason to do abort marking of subtransactions in a nonintuitive order.
2004-08-28Add missing Assert to make TransactionIdDidAbort more consistent withTom Lane
TransactionIdDidCommit.
2004-08-28Fix relcache to account properly for subtransaction status of 'new'Tom Lane
relcache entries. Also, change TransactionIdIsCurrentTransactionId() so that if consulted during transaction abort, it will not say that the aborted xact is still current. (It would be better to ensure that it's never called at all during abort, but I'm not sure we can easily guarantee that.) In combination, these fix a crash we have seen occasionally during parallel regression tests of 8.0.
2004-08-28Can't truncate pg_subtrans during a recovery checkpoint --- subtransTom Lane
module isn't fully initialized yet.
2004-08-25Revise ResourceOwner code to avoid accumulating ResourceOwner objectsTom Lane
for every command executed within a transaction. For long transactions this was a significant memory leak. Instead, we can delete a portal's or subtransaction's ResourceOwner immediately, if we physically transfer the information about its locks up to the parent owner. This does not fully solve the leak problem; we need to do something about counting multiple acquisitions of the same lock in order to fix it. But it's a necessary step along the way.
2004-08-23Rearrange pg_subtrans handling as per recent discussion. pg_subtransTom Lane
updates are no longer WAL-logged nor even fsync'd; we do not need to, since after a crash no old pg_subtrans data is needed again. We truncate pg_subtrans to RecentGlobalXmin at each checkpoint. slru.c's API is refactored a little bit to separate out the necessary decisions.
2004-08-22Tweak code so that pg_subtrans is never consulted for XIDs older thanTom Lane
RecentXmin (== MyProc->xmin). This ensures that it will be safe to truncate pg_subtrans at RecentGlobalXmin, which should largely eliminate any fear of bloat. Along the way, eliminate SubTransXidsHaveCommonAncestor, which isn't really needed and could not give a trustworthy result anyway under the lookback restriction. In an unrelated but nearby change, #ifdef out GetUndoRecPtr, which has been dead code since 2001 and seems unlikely to ever be resurrected.
2004-08-12Cleanup Win32 COPY handling, and move archive examples to SGML.Bruce Momjian
2004-08-12Add mention of "WIN32" COPY.Bruce Momjian
2004-08-12Add make_native_path() because Win32 COPY is an internal CMD.EXE commandBruce Momjian
and doesn't process forward slashes in the same way as external commands. Quoting the first argument to COPY does not convert forward to backward slashes, but COPY does properly process quoted forward slashes in the second argument. Win32 COPY works with quoted forward slashes in the first argument only if the current directory is the same as the directory of the first argument.
2004-08-11Fix failure to guarantee that a checkpoint will write out pg_clog updatesTom Lane
for transaction commits that occurred just before the checkpoint. This is an EXTREMELY serious bug --- kudos to Satoshi Okada for creating a reproducible test case to prove its existence.
2004-08-09When expanding %p in archive_command or restore_command, translateTom Lane
slashes to backslashes #ifdef WIN32. This is to cope with the fact that Windows seems exceedingly unfriendly to slashes in shell commands, as per recent discussion.
2004-08-08Add a comment about why we always replay backup blocks from WAL.Tom Lane
2004-08-04Label CVS tip as 8.0devel instead of 7.5devel. Adjust various commentsTom Lane
and documentation to reference 8.0 instead of 7.5.
2004-08-04Make use of backup label/history files to control recovery properly.Tom Lane
2004-08-03Add functions pg_start_backup, pg_stop_backup to create backup labelTom Lane
and history files as per recent discussion. While at it, remove pg_terminate_backend, since we have decided we do not have time during this release cycle to address the reliability concerns it creates. Split the 'Miscellaneous Functions' documentation section into 'System Information Functions' and 'System Administration Functions', which hopefully will draw the eyes of those looking for such things.
2004-08-03Fix misplacement of savepointLevel test, per report from Chris K-L.Tom Lane
2004-08-01Update the in-code documentation about the transaction system. Move itTom Lane
into a README file instead of being in xact.c's header comment. Alvaro Herrera.
2004-08-01Error message style adjustments, per Alvaro Herrera.Tom Lane
2004-08-01Some mop-up work for savepoints (nested transactions). Store a smallTom Lane
number of active subtransaction XIDs in each backend's PGPROC entry, and use this to avoid expensive probes into pg_subtrans during TransactionIdIsInProgress. Extend EOXactCallback API to allow add-on modules to get control at subxact start/end. (This is deliberately not compatible with the former API, since any uses of that API probably need manual review anyway.) Add basic reference documentation for SAVEPOINT and related commands. Minor other cleanups to check off some of the open issues for subtransactions. Alvaro Herrera and Tom Lane.
2004-07-31plpgsql does exceptions.Tom Lane
There are still some things that need refinement; in particular I fear that the recognized set of error condition names probably has little in common with what Oracle recognizes. But it's a start.
2004-07-28Fix subtransaction behavior for large objects, temp namespace, files,Tom Lane
password/group files. Also allow read-only subtransactions of a read-write parent, but not vice versa. These are the reasonably noncontroversial parts of Alvaro's recent mop-up patch, plus further work on large objects to minimize use of the TopTransactionResourceOwner.
2004-07-27Replace nested-BEGIN syntax for subtransactions with spec-compliantTom Lane
SAVEPOINT/RELEASE/ROLLBACK-TO syntax. (Alvaro) Cause COMMIT of a failed transaction to report ROLLBACK instead of COMMIT in its command tag. (Tom) Fix a few loose ends in the nested-transactions stuff.
2004-07-22Add cross-check that current timeline of pg_control is an ancestor ofTom Lane
recovery_target_timeline --- otherwise there is no path from the backup to the requested timeline. This check was foreseen in the original discussion but I forgot to implement it.