aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
Commit message (Collapse)AuthorAge
* Change planner to use the current true disk file size as its estimate ofTom Lane2004-12-01
| | | | | | | | | | | | | | | | | a relation's number of blocks, rather than the possibly-obsolete value in pg_class.relpages. Scale the value in pg_class.reltuples correspondingly to arrive at a hopefully more accurate number of rows. When pg_class contains 0/0, estimate a tuple width from the column datatypes and divide that into current file size to estimate number of rows. This improved methodology allows us to jettison the ancient hacks that put bogus default values into pg_class when a table is first created. Also, per a suggestion from Simon, make VACUUM (but not VACUUM FULL or ANALYZE) adjust the value it puts into pg_class.reltuples to try to represent the mean tuple density instead of the minimal density that actually prevails just after VACUUM. These changes alter the plans selected for certain regression tests, so update the expected files accordingly. (I removed join_1.out because it's not clear if it still applies; we can add back any variant versions as they are shown to be needed.)
* Minor adjustment of message style.Tom Lane2004-11-17
|
* Micro-optimization of markpos() and restrpos() in btree and hash indexes.Neil Conway2004-11-17
| | | | | | Rather than using ReadBuffer() to increment the reference count on an already-pinned buffer, we should use IncrBufferRefCount() as it is faster and does not require acquiring the BufMgrLock.
* Don't allow pg_start_backup() to be invoked if archive_command has notNeil Conway2004-11-17
| | | | been defined. Patch from Gavin Sherry, editorializing by Neil Conway.
* There is no need for ReadBuffer() call sites to check that the returnedNeil Conway2004-11-14
| | | | | | buffer is valid, as ReadBuffer() will elog on error. Most of the call sites of ReadBuffer() got this right, but this patch fixes those call sites that did not.
* Remove obsolete comment from btbuild() and hashbuild(): we no longer useNeil Conway2004-11-11
| | | | a global variable to control building indexes.
* Small message clarificationsPeter Eisentraut2004-11-05
|
* Change COMMIT back to the old behavior of emitting command tag COMMIT,Tom Lane2004-10-30
| | | | | 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-29
| | | | ON COMMIT actions. Per bug report from Michael Guerin.
* Add DEBUG1-level logging of checkpoint start and end. Also, reduce theTom Lane2004-10-29
| | | | | | '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.
* Make heap_fetch API more consistent by having the buffer remain pinnedTom Lane2004-10-26
| | | | | | in all cases when keep_buf = true. This allows ANALYZE's inner loop to use heap_release_fetch, which saves multiple buffer lookups for the same page and avoids overestimation of cost by the vacuum cost mechanism.
* Allow functions returning void or cstring to appear in FROM clause,Tom Lane2004-10-20
| | | | | | to make life cushy for the JDBC driver. Centralize the decision-making that affects this by inventing a get_type_func_class() function, rather than adding special cases in half a dozen places.
* Give the ResourceOwner mechanism full responsibility for releasing bufferTom Lane2004-10-16
| | | | | | | | 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.
* Repair possible failure to update hint bits back to disk, perTom Lane2004-10-15
| | | | | | | | | | http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php. This fix is intended to be permanent: it moves the responsibility for calling SetBufferCommitInfoNeedsSave() into the tqual.c routines, eliminating the requirement for callers to test whether t_infomask changed. Also, tighten validity checking on buffer IDs in bufmgr.c --- several routines were paranoid about out-of-range shared buffer numbers but not about out-of-range local ones, which seems a tad pointless.
* Add 'int' cast for getpid() because some Solaris releases return longBruce Momjian2004-10-14
| | | | for getpid().
* Message style revisionsPeter Eisentraut2004-10-12
|
* Make getpid() use %d consistently for printing.Bruce Momjian2004-10-09
|
* Adjust comments previously moved to column 1 by pgident.Bruce Momjian2004-10-07
|
* PortalRun must guard against the possibility that the portal it'sTom Lane2004-10-04
| | | | | | | | | | | | | | 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.
* Code review for NOWAIT patch: downgrade NOWAIT from fully reserved keywordTom Lane2004-10-01
| | | | | | to unreserved keyword, use ereport not elog, assign a separate error code for 'could not obtain lock' so that applications will be able to detect that case cleanly.
* Adjust index locking rules as per my proposal of earlier today. YouTom Lane2004-09-30
| | | | | | now are supposed to take some kind of lock on an index whenever you are going to access the index contents, rather than relying only on a lock on the parent table.
* Code cleanup: don't bother casting the argument to pfree() to void *Neil Conway2004-09-27
| | | | | from another pointer type. Per C89, this is unnecessary, and it is common practice throughout the rest of the tree anyway.
* 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.