summaryrefslogtreecommitdiff
path: root/src/backend/access/transam
Commit message (Collapse)AuthorAgeFilesLines
* Check the file system on postmaster startup and report any unreferencedBruce Momjian2005-05-021-1/+10
| | | | | | files in the server log. Heikki Linnakangas
* Implement sharable row-level locks, and use them for foreign key referencesTom Lane2005-04-284-11/+1627
| | | | | | | | | | | | | | | to eliminate unnecessary deadlocks. This commit adds SELECT ... FOR SHARE paralleling SELECT ... FOR UPDATE. The implementation uses a new SLRU data structure (managed much like pg_subtrans) to represent multiple- transaction-ID sets. When more than one transaction is holding a shared lock on a particular row, we create a MultiXactId representing that set of transactions and store its ID in the row's XMAX. This scheme allows an effectively unlimited number of row locks, just as we did before, while not costing any extra overhead except when a shared lock actually has to be shared. Still TODO: use the regular lock manager to control the grant order when multiple backends are waiting for a row lock. Alvaro Herrera and Tom Lane.
* Add comment about checkpoint panic behavior during shutdown, perTom Lane2005-04-231-2/+5
| | | | suggestion from Qingqing Zhou.
* Fix comment typo.Bruce Momjian2005-04-171-2/+2
|
* Reduce PANIC to ERROR in several xlog routines that are used in bothTom Lane2005-04-151-26/+40
| | | | | | | | | | critical and noncritical contexts (an example of noncritical being post-checkpoint removal of dead xlog segments). In the critical cases the CRIT_SECTION mechanism will cause ERROR to be promoted to PANIC anyway, and in the noncritical cases we shouldn't let an error take down the entire database. Arguably there should be *no* explicit PANIC errors in this module, only more START/END_CRIT_SECTION calls, but I didn't go that far. (Yet.)
* Modify MoveOfflineLogs/InstallXLogFileSegment to avoid O(N^2) behaviorTom Lane2005-04-151-23/+37
| | | | | | | when recycling a large number of xlog segments during checkpoint. The former behavior searched from the same start point each time, requiring O(checkpoint_segments^2) stat() calls to relocate all the segments. Instead keep track of where we stopped last time through.
* Simplify initdb-time assignment of OIDs as I proposed yesterday, andTom Lane2005-04-132-7/+29
| | | | | | | | avoid encroaching on the 'user' range of OIDs by allowing automatic OID assignment to use values below 16k until we reach normal operation. initdb not forced since this doesn't make any incompatible change; however a lot of stuff will have different OIDs after your next initdb.
* Fix interaction between materializing holdable cursors and firingTom Lane2005-04-111-9/+25
| | | | | | deferred triggers: either one can create more work for the other, so we have to loop till it's all gone. Per example from andrew@supernews. Add a regression test to help spot trouble in this area in future.
* Officially decouple FUNC_MAX_ARGS from INDEX_MAX_KEYS, and set theTom Lane2005-03-291-6/+6
| | | | | | former to 100 by default. Clean up some of the less necessary dependencies on FUNC_MAX_ARGS; however, the biggie (FunctionCallInfoData) remains.
* Remove dead push/pop rollback code. Vadim once planned to implementTom Lane2005-03-281-22/+1
| | | | | | transaction rollback via UNDO but I think that's highly unlikely to happen, so we may as well remove the stubs. (Someday we ought to rip out the stub xxx_undo routines, too.) Per Alvaro.
* Change Win32 O_SYNC method to O_DSYNC because that is what the methodBruce Momjian2005-03-241-2/+16
| | | | | | | | | | | currently does. This is now the default Win32 wal sync method because we perfer o_datasync to fsync. Also, change Win32 fsync to a new wal sync method called fsync_writethrough because that is the behavior of _commit, which is what is used for fsync on Win32. Backpatch to 8.0.X.
* Remove some no-longer-needed kluges for bootstrapping, in particularTom Lane2005-02-203-49/+14
| | | | | | | | the AMI_OVERRIDE flag. The fact that TransactionLogFetch treats BootstrapTransactionId as always committed is sufficient to make bootstrap work, and getting rid of extra tests in heavily used code paths seems like a win. The files produced by initdb are demonstrably the same after this change.
* Add code to prevent transaction ID wraparound by enforcing a safe limitTom Lane2005-02-202-15/+146
| | | | | | | | | | | | | | in GetNewTransactionId(). Since the limit value has to be computed before we run any real transactions, this requires adding code to database startup to scan pg_database and determine the oldest datfrozenxid. This can conveniently be combined with the first stage of an attack on the problem that the 'flat file' copies of pg_shadow and pg_group are not properly updated during WAL recovery. The code I've added to startup resides in a new file src/backend/utils/init/flatfiles.c, and it is responsible for rewriting the flat files as well as initializing the XID wraparound limit value. This will eventually allow us to get rid of GetRawDatabaseInfo too, but we'll need an initdb so we can add a trigger to pg_database.
* Move plpgsql DEBUG from DEBUG2 to DEBUG1 because it is a user-requestedBruce Momjian2005-02-122-6/+6
| | | | | | DEBUG. Fix a few places where DEBUG1 crept in that should have been DEBUG2.
* Phase 1 of fix for 'SMgrRelation hashtable corrupted' problem. ThisTom Lane2005-01-101-7/+5
| | | | | | is the minimum required fix. I want to look next at taking advantage of it by simplifying the message semantics in the shared inval message queue, but that part can be held over for 8.1 if it turns out too ugly.
* Update copyrights that were missed.Bruce Momjian2005-01-011-2/+2
|
* Tag appropriate files for rc3PostgreSQL Daemon2004-12-317-14/+14
| | | | | | | | Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
* Awhile back I added some code to StartupCLOG() to forcibly zero outTom Lane2004-12-221-13/+19
| | | | | | | | | | the remainder of the current clog page during system startup. While this was a good idea, it turns out the code fails if nextXid is exactly at a page boundary, because we won't have created the "current" clog page yet in that case. Since the page will be correctly zeroed when we execute the first transaction on it, the solution is just to do nothing when exactly at a page boundary. Per trouble report from Dave Hartwig.
* Fix is-it-time-for-a-checkpoint logic so that checkpoint_segments canTom Lane2004-12-171-9/+26
| | | | usefully be larger than 255. Per gripe from Simon Riggs.
* Minor adjustment of message style.Tom Lane2004-11-171-3/+3
|
* Don't allow pg_start_backup() to be invoked if archive_command has notNeil Conway2004-11-171-1/+9
| | | | been defined. Patch from Gavin Sherry, editorializing by Neil Conway.
* Small message clarificationsPeter Eisentraut2004-11-051-3/+3
|
* Change COMMIT back to the old behavior of emitting command tag COMMIT,Tom Lane2004-10-301-6/+6
| | | | | not ROLLBACK, for the case of COMMIT outside a transaction block. Alvaro Herrera
* Rearrange order of pre-commit operations: must close cursors before doingTom Lane2004-10-291-19/+20
| | | | ON COMMIT actions. Per bug report from Michael Guerin.
* Add DEBUG1-level logging of checkpoint start and end. Also, reduce theTom Lane2004-10-291-10/+34
| | | | | | '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.
* Give the ResourceOwner mechanism full responsibility for releasing bufferTom Lane2004-10-161-1/+5
| | | | | | | | 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.
* Add 'int' cast for getpid() because some Solaris releases return longBruce Momjian2004-10-141-4/+4
| | | | for getpid().
* Message style revisionsPeter Eisentraut2004-10-121-8/+8
|
* Make getpid() use %d consistently for printing.Bruce Momjian2004-10-091-7/+4
|
* Adjust comments previously moved to column 1 by pgident.Bruce Momjian2004-10-071-2/+2
|
* PortalRun must guard against the possibility that the portal it'sTom Lane2004-10-041-3/+33
| | | | | | | | | | | | | | 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.
* Add some marginal tweaks to eliminate memory leakages associated withTom Lane2004-09-161-7/+50
| | | | | 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-162-14/+14
| | | | | | | 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-163-621/+834
| | | | | | | | | | | | | | | | | 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-131-5/+7
| | | | | | | | | | | | | 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.
* Fire non-deferred AFTER triggers immediately upon query completion,Tom Lane2004-09-101-43/+39
| | | | | | | | | | | | | 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-061-10/+14
| | | | | 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-062-5/+5
| | | | subtrans segments. Per Greg Mullane and Chris K-L.
* Ensure that the remainder of the current pg_clog page is zeroed duringTom Lane2004-08-301-2/+33
| | | | startup, just to be sure that there's no leftover junk there.
* Fix failure to advance nextXID beyond subtransactions whose XIDs appearTom Lane2004-08-301-6/+42
| | | | only within COMMIT or ABORT records.
* Another pgindent run with lib typedefs added.Bruce Momjian2004-08-302-6/+6
|
* Add WAL logging for CREATE/DROP DATABASE and CREATE/DROP TABLESPACE.Tom Lane2004-08-291-5/+7
| | | | | | | | 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-291-55/+61
| | | | | | | | | 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-298-616/+695
|
* Update copyright to 2004.Bruce Momjian2004-08-298-16/+16
|
* Now that TransactionIdDidAbort doesn't think it should try to modifyTom Lane2004-08-281-6/+6
| | | | | 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-281-1/+2
| | | | TransactionIdDidCommit.
* Fix relcache to account properly for subtransaction status of 'new'Tom Lane2004-08-281-6/+13
| | | | | | | | | 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-281-3/+5
| | | | module isn't fully initialized yet.
* Revise ResourceOwner code to avoid accumulating ResourceOwner objectsTom Lane2004-08-251-17/+38
| | | | | | | | | | 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.