aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
Commit message (Collapse)AuthorAge
* Get rid of the SpinLockAcquire/SpinLockAcquire_NoHoldoff distinctionTom Lane2005-12-29
| | | | | | | | | | in favor of having just one set of macros that don't do HOLD/RESUME_INTERRUPTS (hence, these correspond to the old SpinLockAcquire_NoHoldoff case). Given our coding rules for spinlock use, there is no reason to allow CHECK_FOR_INTERRUPTS to be done while holding a spinlock, and also there is no situation where ImmediateInterruptOK will be true while holding a spinlock. Therefore doing HOLD/RESUME_INTERRUPTS while taking/releasing a spinlock is just a waste of cycles. Qingqing Zhou and Tom Lane.
* Arrange to set the LC_XXX environment variables to match our localeTom Lane2005-12-28
| | | | | | setup. This protects against undesired changes in locale behavior if someone carelessly does setlocale(LC_ALL, "") (and we know who you are, perl guys).
* I have added these macros to c.h:Bruce Momjian2005-12-25
| | | | | | | | | #define HIGHBIT (0x80) #define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT) and removed CSIGNBIT and mapped it uses to HIGHBIT. I have also added uses for IS_HIGHBIT_SET where appropriate. This change is purely for code clarity.
* Adjust string comparison so that only bitwise-equal strings are consideredTom Lane2005-12-22
| | | | | | | | | | | | equal: if strcoll claims two strings are equal, check it with strcmp, and sort according to strcmp if not identical. This fixes inconsistent behavior under glibc's hu_HU locale, and probably under some other locales as well. Also, take advantage of the now-well-defined behavior to speed up texteq, textne, bpchareq, bpcharne: they may as well just do a bitwise comparison and not bother with strcoll at all. NOTE: affected databases may need to REINDEX indexes on text columns to be sure they are self-consistent.
* Divide the lock manager's shared state into 'partitions', so as toTom Lane2005-12-11
| | | | | | | reduce contention for the former single LockMgrLock. Per my recent proposal. I set it up for 16 partitions, but on a pgbench test this gives only a marginal further improvement over 4 partitions --- we need to test more scenarios to choose the number of partitions.
* Push the responsibility for handling ignore_killed_tuples down intoTom Lane2005-12-07
| | | | | | _bt_checkkeys(), instead of checking it in the top-level nbtree.c routines as formerly. This saves a little bit of loop overhead, but more importantly it lets us skip performing the index key comparisons for dead tuples.
* A couple of tiny performance hacks in _bt_step(). Remove PageIsEmptyTom Lane2005-12-07
| | | | | | | | | checks, which were once needed because PageGetMaxOffsetNumber would fail on empty pages, but are now just redundant. Also, don't set up local variables that aren't needed in the fast path --- most of the time, we only need to advance offnum and not step across a page boundary. Motivated by noticing _bt_step at the top of OProfile profile for a pgbench run.
* Get rid of slru.c's hardwired insistence on a fixed number of slots perTom Lane2005-12-06
| | | | | | | | | SLRU area. The number of slots is still a compile-time constant (someday we might want to change that), but at least it's a different constant for each SLRU area. Increase number of subtrans buffers to 32 based on experimentation with a heavily subtrans-bashing test case, and increase number of multixact member buffers to 16, since it's obviously silly for it not to be at least twice the number of multixact offset buffers.
* Arrange for read-only accesses to SLRU page buffers to take only a sharedTom Lane2005-12-06
| | | | | | | | | | lock, not exclusive, if the desired page is already in memory. This can be demonstrated to be a significant win on the pg_subtrans cache when there is a large window of open transactions. It should be useful for pg_clog as well. I didn't try to make GetMultiXactIdMembers() use the code, as that would have taken some restructuring, and what with the local cache for multixact contents it probably wouldn't really make a difference. Per my recent proposal.
* Tweak indexscan machinery to avoid taking an AccessShareLock on an indexTom Lane2005-12-03
| | | | | | | if we already have a stronger lock due to the index's table being the update target table of the query. Same optimization I applied earlier at the table level. There doesn't seem to be much interest in the more radical idea of not locking indexes at all, so do what we can ...
* Some marginal additional hacking to shave a few more cycles offTom Lane2005-11-26
| | | | heapgettup.
* Change seqscan logic so that we check visibility of all tuples on a pageTom Lane2005-11-26
| | | | | | | | | | | | | | when we first read the page, rather than checking them one at a time. This allows us to take and release the buffer content lock just once per page, instead of once per tuple. Since it's a shared lock the contention penalty for holding the lock longer shouldn't be too bad. We can safely do this only when using an MVCC snapshot; else the assumption that visibility won't change over time is uncool. Therefore there are now two code paths depending on the snapshot type. I also made the same change in nodeBitmapHeapscan.c, where it can be done always because we only support MVCC snapshots for bitmap scans anyway. Also make some incidental cleanups in the APIs of these functions. Per a suggestion from Qingqing Zhou.
* Re-run pgindent, fixing a problem where comment lines after a blankBruce Momjian2005-11-22
| | | | | | | | | comment line where output as too long, and update typedefs for /lib directory. Also fix case where identifiers were used as variable names in the backend, but as typedefs in ecpg (favor the backend for indenting). Backpatch to 8.1.X.
* Remove the t_datamcxt field of HeapTupleData. This was introduced forTom Lane2005-11-20
| | | | | the convenience of tuptoaster.c and is no longer needed, so may as well get rid of some small amount of overhead.
* Modify tuptoaster's API so that it does not try to modify the passedTom Lane2005-11-20
| | | | | | | | | tuple in-place, but instead passes back an all-new tuple structure if any changes are needed. This is a much cleaner and more robust solution for the bug discovered by Alexey Beschiokov; accordingly, revert the quick hack I installed yesterday. With this change, HeapTupleData.t_datamcxt is no longer needed; will remove it in a separate commit in HEAD only.
* R-tree is dead ... long live GiST.Tom Lane2005-11-07
|
* Add simple sanity checks on newly-read pages to GiST, too.Tom Lane2005-11-06
|
* Add defenses to btree and hash index AMs to do simple sanity checksTom Lane2005-11-06
| | | | | | | | | on every index page they read; in particular to catch the case of an all-zero page, which PageHeaderIsValid allows to pass. It turns out hash already had this idea, but it was just Assert()ing things rather than doing a straight error check, and the Asserts were partially redundant with PageHeaderIsValid anyway. Per recent failure example from Jim Nasby. (gist still needs the same treatment.)
* Clean up representation of SLRU page state. This is the cleaner fixTom Lane2005-11-05
| | | | | for the SLRU race condition that I posted a few days ago, but we decided not to use in 8.1 and older branches.
* Rename the members of CommandDest enum so they don't collide with other uses ofAlvaro Herrera2005-11-03
| | | | | those names. (Debug and None were pretty bad names anyway.) I hope I catched all uses of the names in comments too.
* Fix longstanding race condition in transaction log management: there was aTom Lane2005-11-03
| | | | | | | | | | | very narrow window in which SimpleLruReadPage or SimpleLruWritePage could think that I/O was needed when it wasn't (and indeed the buffer had already been assigned to another page). This would result in an Assert failure if Asserts were enabled, and probably in silent data corruption if not. Reported independently by Jim Nasby and Robert Creager. I intend a more extensive fix when 8.2 development starts, but this is a reasonably low-impact patch for the existing branches.
* Message correctionsPeter Eisentraut2005-10-29
|
* Reorder code so that we don't have to hold a critical section whileTom Lane2005-10-28
| | | | | reserving SLRU space for a new MultiXact. The original coding would have treated out-of-disk-space as a PANIC condition, which is unnecessary.
* Fix race condition in multixact code: it's possible to try to read aTom Lane2005-10-28
| | | | | | | | | | multixact's starting offset before the offset has been stored into the SLRU file. A simple fix would be to hold the MultiXactGenLock until the offset has been stored, but that looks like a big concurrency hit. Instead rely on knowledge that unset offsets will be zero, and loop when we see a zero. This requires a little extra hacking to ensure that zero is never a valid value for the offset. Problem reported by Matteo Beccati, fix ideas from Martijn van Oosterhout, Alvaro Herrera, and Tom Lane.
* Make code for selecting default WAL sync method less confusing.Tom Lane2005-10-22
|
* Better solution to the problem of labeling whole-row Datums that areTom Lane2005-10-19
| | | | | | generated from subquery outputs: use the type info stored in the Var itself. To avoid making ExecEvalVar and slot_getattr more complex and slower, I split out the whole-row case into a separate ExecEval routine.
* Ensure that the Datum generated from a whole-row Var contains validTom Lane2005-10-19
| | | | | | type ID information even when it's a record type. This is needed to handle whole-row Vars referencing subquery outputs. Per example from Richard Huxton.
* A few trivial code cleanups motivated by reading warnings generatedTom Lane2005-10-18
| | | | | by a recent HP C compiler. Mostly, get rid of useless local variables that are assigned to but never used.
* Standard pgindent run for 8.1.Bruce Momjian2005-10-15
|
* This makes the error messages for PREPARE TRANSACTION, COMMIT PREPAREDBruce Momjian2005-10-13
| | | | | | | etc. match the docs, which talk about "transaction identifier" not "gid" or "global transaction identifier". Steve Woodcock
* Back out this because of fear of changing error strings:Bruce Momjian2005-10-13
| | | | | | | | This makes the error messages for PREPARE TRANSACTION, COMMIT PREPARED etc. match the docs, which talk about "transaction identifier" not "gid" or "global transaction identifier". Steve Woodcock
* This makes the error messages for PREPARE TRANSACTION, COMMIT PREPAREDBruce Momjian2005-10-13
| | | | | | | etc. match the docs, which talk about "transaction identifier" not "gid" or "global transaction identifier". Steve Woodcock
* Fix longstanding bug found by Atsushi Ogawa: _bt_check_unique would markTom Lane2005-10-12
| | | | | | the wrong buffer dirty when trying to kill a dead index entry that's on a page after the one it started on. No risk of data corruption, just inefficiency, but still a bug.
* Revise pgstats stuff to fix the problems with not counting accessesTom Lane2005-10-06
| | | | | | | generated by bitmap index scans. Along the way, simplify and speed up the code for counting sequential and index scans; it was both confusing and inefficient to be taking care of that in the per-tuple loops, IMHO. initdb forced because of internal changes in pg_stat view definitions.
* Expand pg_control information so that we can verify that the databaseTom Lane2005-10-03
| | | | | | was created on a machine with alignment rules and floating-point format similar to the current machine. Per recent discussion, this seems like a good idea with the increasing prevalence of 32/64 bit environments.
* Clean up possibly-uninitialized-variable warnings reported by gcc 4.x.Tom Lane2005-09-24
|
* pgindent new GIST index code, per request from Tom.Bruce Momjian2005-09-22
|
* Adjust GiST error messages to conform to message style guidelines.Tom Lane2005-09-22
|
* Small fixesTeodor Sigaev2005-09-16
|
* Copy-editing for GiST README.Neil Conway2005-09-15
|
* Readme about GiST's algorithmsTeodor Sigaev2005-09-15
|
* Clean up a couple of ad-hoc computations of the maximum number of tuplesTom Lane2005-09-02
| | | | | | | | | | | on a page, as suggested by ITAGAKI Takahiro. Also, change a few places that were using some other estimates of max-items-per-page to consistently use MaxOffsetNumber. This is conservatively large --- we could have used the new MaxHeapTuplesPerPage macro, or a similar one for index tuples --- but those places are simply declaring a fixed-size buffer and assuming it will work, rather than actively testing for overrun. It seems safer to size these buffers in a way that can't overflow even if the page is corrupt.
* Reduce default value of max_prepared_transactions from 50 to 5. ThisTom Lane2005-08-29
| | | | | | | | | saves nearly 700kB in the default shared memory segment size, which seems worthwhile, and it is a feature that many users won't use anyway. Per Heikki's argument, there is no point in a compromise value --- those who are using 2PC at all will probably want it at least equal to max_connections. But we can't set it to zero by default without breaking the prepared_xacts regression test.
* Rewrite gather-write patch into something less obviously bolted onTom Lane2005-08-22
| | | | | | | | | after the fact. Fix bug with incorrect test for whether we are at end of logfile segment. Arrange for writes triggered by XLogInsert's is-cache-more-than-half-full test to synchronize with the cache boundaries, so that in long transactions we tend to write alternating halves of the cache rather than randomly chosen portions of it; this saves one more write syscall per cache load.
* Improve xid wraparound message (the server isn't really shut down, justBruce Momjian2005-08-22
| | | | | | | | | not accepting queries). errmsg("database is not accepting queries to avoid wraparound data loss in database \"%s\"", errhint("Stop the postmaster and use a standalone backend to VACUUM database \"%s\".",
* Fix some inconsistent choices of datatypes in xlog.c. Make bufferTom Lane2005-08-22
| | | | | indexes all be int, rather than variously int, uint16 and uint32; add some casts where necessary to support large buffer arrays.
* Seems that the childXids list would be better based on Oid lists thanTom Lane2005-08-20
| | | | integer lists.
* Convert the arithmetic for shared memory size calculation from 'int'Tom Lane2005-08-20
| | | | | | | | | | | to 'Size' (that is, size_t), and install overflow detection checks in it. This allows us to remove the former arbitrary restrictions on NBuffers etc. It won't make any difference in a 32-bit machine, but in a 64-bit machine you could theoretically have terabytes of shared buffers. (How efficiently we could manage 'em remains to be seen.) Similarly, num_temp_buffers, work_mem, and maintenance_work_mem can be set above 2Gb on a 64-bit machine. Original patch from Koichi Suzuki, additional work by moi.
* Make GetMultiXactIdMembers() a public function.Tatsuo Ishii2005-08-20
|
* Repair problems with VACUUM destroying t_ctid chains too soon, and withTom Lane2005-08-20
| | | | | | | | | | | | insufficient paranoia in code that follows t_ctid links. (We must do both because even with VACUUM doing it properly, the intermediate state with a dangling t_ctid link is visible concurrently during lazy VACUUM, and could be seen afterwards if either type of VACUUM crashes partway through.) Also try to improve documentation about what's going on. Patch is a bit bulky because passing the XMAX information around required changing the APIs of some low-level heapam.c routines, but it's not conceptually very complicated. Per trouble report from Teodor and subsequent analysis. This needs to be back-patched, but I'll do that after 8.1 beta is out.