aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
Commit message (Collapse)AuthorAge
* Now that xmax and cmin are distinct fields again, we should zero xmax whenTom Lane2004-09-17
| | | | | | creating a new tuple. This is just for debugging sanity, though, since nothing should be paying any attention to xmax when the HEAP_XMAX_INVALID bit is set.
* Add some marginal tweaks to eliminate memory leakages associated withTom Lane2004-09-16
| | | | | subtransactions. Trivial subxacts (such as a plpgsql exception block containing no database access) now demonstrably leak zero bytes.
* RecentXmin is too recent to use as the cutoff point for accessingTom Lane2004-09-16
| | | | | | | 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.
* Restructure subtransaction handling to reduce resource consumption,Tom Lane2004-09-16
| | | | | | | | | | | | | | | | | 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.
* Redesign query-snapshot timing so that volatile functions in READ COMMITTEDTom Lane2004-09-13
| | | | | | | | | | | | | 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.
* Renumber SnapshotNow and the other special snapshot codes so thatTom Lane2004-09-11
| | | | | | | | ((Snapshot) NULL) can no longer be confused with a valid snapshot, as per my recent suggestion. Define a macro InvalidSnapshot for 0. Use InvalidSnapshot instead of SnapshotAny as the do-nothing special case for heap_update and heap_delete crosschecks; this seems a little cleaner even though the behavior is really the same.
* Fire non-deferred AFTER triggers immediately upon query completion,Tom Lane2004-09-10
| | | | | | | | | | | | | 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.
* Fix incorrect ordering of smgr cleanup relative to buffer pin cleanupTom Lane2004-09-06
| | | | | during transaction abort. Add a regression test case to catch related mistakes in future. Alvaro Herrera and Tom Lane.
* Downgrade LOG messages to DEBUG1 for normal recycling of xlog, clog,Tom Lane2004-09-06
| | | | subtrans segments. Per Greg Mullane and Chris K-L.
* Ensure that the remainder of the current pg_clog page is zeroed duringTom Lane2004-08-30
| | | | startup, just to be sure that there's no leftover junk there.
* Fix failure to advance nextXID beyond subtransactions whose XIDs appearTom Lane2004-08-30
| | | | only within COMMIT or ABORT records.
* Another pgindent run with lib typedefs added.Bruce Momjian2004-08-30
|
* Add WAL logging for CREATE/DROP DATABASE and CREATE/DROP TABLESPACE.Tom Lane2004-08-29
| | | | | | | | 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.
* Widen xl_len field of XLogRecord header to 32 bits, so that we'll haveTom Lane2004-08-29
| | | | | | | | | 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.
* Pgindent run for 8.0.Bruce Momjian2004-08-29
|
* Update copyright to 2004.Bruce Momjian2004-08-29
|
* Now that TransactionIdDidAbort doesn't think it should try to modifyTom Lane2004-08-28
| | | | | pg_clog, there's no reason to do abort marking of subtransactions in a nonintuitive order.
* Add missing Assert to make TransactionIdDidAbort more consistent withTom Lane2004-08-28
| | | | TransactionIdDidCommit.
* Fix relcache to account properly for subtransaction status of 'new'Tom Lane2004-08-28
| | | | | | | | | 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.
* Can't truncate pg_subtrans during a recovery checkpoint --- subtransTom Lane2004-08-28
| | | | module isn't fully initialized yet.
* Revise ResourceOwner code to avoid accumulating ResourceOwner objectsTom Lane2004-08-25
| | | | | | | | | | 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.
* Rearrange pg_subtrans handling as per recent discussion. pg_subtransTom Lane2004-08-23
| | | | | | | 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.
* Tweak code so that pg_subtrans is never consulted for XIDs older thanTom Lane2004-08-22
| | | | | | | | | | 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.
* Fix bug introduced into _bt_getstackbuf() on 2003-Feb-21: the initialTom Lane2004-08-17
| | | | | | | | | | value of 'start' could be past the end of the page, if the page was split by some concurrent inserting process since we visited it. In this situation the code could look at bogus entries and possibly find a match (since after all those entries still contain what they had before the split). This would lead to 'specified item offset is too large' followed by 'PANIC: failed to add item to the page', as reported by Joe Conway for scenarios involving heavy concurrent insertion activity.
* Dept. of further reflection: I looked around to see if any other callersTom Lane2004-08-15
| | | | | | | | | | | | of XLogInsert had the same sort of checkpoint interlock problem as RecordTransactionCommit, and indeed I found some. Btree index build and ALTER TABLE SET TABLESPACE write data outside the friendly confines of the buffer manager, and therefore they have to take their own responsibility for checkpoint interlock. The easiest solution seems to be to force smgrimmedsync at the end of the index build or table copy, even when the operation is being WAL-logged. This is sufficient since the new index or table will be of interest to no one if we don't get as far as committing the current transaction.
* Cleanup Win32 COPY handling, and move archive examples to SGML.Bruce Momjian2004-08-12
|
* Add mention of "WIN32" COPY.Bruce Momjian2004-08-12
|
* Add make_native_path() because Win32 COPY is an internal CMD.EXE commandBruce Momjian2004-08-12
| | | | | | | | | | 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.
* Fix failure to guarantee that a checkpoint will write out pg_clog updatesTom Lane2004-08-11
| | | | | | 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.
* When expanding %p in archive_command or restore_command, translateTom Lane2004-08-09
| | | | | | 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.
* Add a comment about why we always replay backup blocks from WAL.Tom Lane2004-08-08
|
* Label CVS tip as 8.0devel instead of 7.5devel. Adjust various commentsTom Lane2004-08-04
| | | | and documentation to reference 8.0 instead of 7.5.
* Make use of backup label/history files to control recovery properly.Tom Lane2004-08-04
|
* Add functions pg_start_backup, pg_stop_backup to create backup labelTom Lane2004-08-03
| | | | | | | | | 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.
* Fix misplacement of savepointLevel test, per report from Chris K-L.Tom Lane2004-08-03
|
* Update the in-code documentation about the transaction system. Move itTom Lane2004-08-01
| | | | | into a README file instead of being in xact.c's header comment. Alvaro Herrera.
* Error message style adjustments, per Alvaro Herrera.Tom Lane2004-08-01
|
* Some mop-up work for savepoints (nested transactions). Store a smallTom Lane2004-08-01
| | | | | | | | | | | | 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.
* plpgsql does exceptions.Tom Lane2004-07-31
| | | | | | 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.
* Fix subtransaction behavior for large objects, temp namespace, files,Tom Lane2004-07-28
| | | | | | | 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.
* Replace nested-BEGIN syntax for subtransactions with spec-compliantTom Lane2004-07-27
| | | | | | | 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.
* Add cross-check that current timeline of pg_control is an ancestor ofTom Lane2004-07-22
| | | | | | 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.
* Add a check on file size as an additional safety check that a WAL fileTom Lane2004-07-22
| | | | | | | | | recovered from archive is not corrupt. It's not much but it will catch one common problem, viz out-of-disk-space. Also, force a WAL recovery scan when recovery.conf is present, even if pg_control shows a clean shutdown. This allows recovery with a tar backup that was taken with the postmaster shut down, as per complaint from Mark Kirkwood.
* Invent WAL timelines, as per recent discussion, to make point-in-timeTom Lane2004-07-21
| | | | | | | | recovery more manageable. Also, undo recent change to add FILE_HEADER and WASTED_SPACE records to XLOG; instead make the XLOG page header variable-size with extra fields in the first page of an XLOG file. This should fix the boundary-case bugs observed by Mark Kirkwood. initdb forced due to change of XLOG representation.
* Remove unportable use of strptime() to parse recovery target time spec.Tom Lane2004-07-19
| | | | Instead use our own abstimein code, which is more flexible anyway.
* XLOG file archiving and point-in-time recovery. There are still someTom Lane2004-07-19
| | | | | | loose ends and a glaring lack of documentation, but it basically works. Simon Riggs with some editorialization by Tom Lane.
* Invent ResourceOwner mechanism as per my recent proposal, and use it toTom Lane2004-07-17
| | | | | | | | keep track of portal-related resources separately from transaction-related resources. This allows cursors to work in a somewhat sane fashion with nested transactions. For now, cursor behavior is non-subtransactional, that is a cursor's state does not roll back if you abort a subtransaction that fetched from the cursor. We might want to change that later.
* Rename XLOG_BTREE_NEWPAGE xlog record type into XLOG_HEAP_NEWPAGE, andTom Lane2004-07-11
| | | | | | | | | | shift support code into heapam.c accordingly. This is in service of soon-to-be-committed ALTER TABLE SET TABLESPACE code that will want to use this same record type for both heaps and indexes. Theoretically I should have forced initdb for this, but in practice there is no change in xlog contents because CVS tip will never really emit this record type anyhow...
* Fix no-longer-correct bit-pushing in TransactionIdSetStatus, per Alvaro.Tom Lane2004-07-03
|
* Further review of xact.c state machine for nested transactions. FixTom Lane2004-07-01
| | | | | problems with starting subtransactions inside already-failed transactions. Clean up some comments.