aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage
Commit message (Collapse)AuthorAge
* Modify pgstats code to reduce performance penalties from oversized stats dataTom Lane2006-01-18
| | | | | | | | | | | | | files: avoid creating stats hashtable entries for tables that aren't being touched except by vacuum/analyze, ensure that entries for dropped tables are removed promptly, and tweak the data layout to avoid storing useless struct padding. Also improve the performance of pgstat_vacuum_tabstat(), and make sure that autovacuum invokes it exactly once per autovac cycle rather than multiple times or not at all. This should cure recent complaints about 8.1 showing much higher stats I/O volume than was seen in 8.0. It'd still be a good idea to revisit the design with an eye to not re-writing the entire stats dataset every half second ... but that would be too much to backpatch, I fear.
* Fix fsync code to test whether F_FULLFSYNC is available, instead ofTom Lane2006-01-17
| | | | assuming it always is on Darwin. Per report from Neil Brandt.
* Fix ReadBuffer() to correctly handle the case where it's trying to extendTom Lane2006-01-06
| | | | | | | | | the relation but it finds a pre-existing valid buffer. The buffer does not correspond to any page known to the kernel, so we *must* do smgrextend to ensure that the space becomes allocated. The 7.x branches all do this correctly, but the corner case got lost somewhere during 8.0 bufmgr rewrites. (My fault no doubt :-( ... I think I assumed that such a buffer must be not-BM_VALID, which is not so.)
* Retry in FileRead and FileWrite if Windows returns ERROR_NO_SYSTEM_RESOURCES.Tom Lane2005-12-01
| | | | | | Also add a retry for Unixen returning EINTR, which hasn't been reported as an issue but at least theoretically could be. Patch by Qingqing Zhou, some minor adjustments by me.
* 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.
* DropRelFileNodeBuffers failed to fix the state of the lookup hash tableTom Lane2005-11-17
| | | | | | | | that was added to localbuf.c in 8.1; therefore, applying it to a temp table left corrupt lookup state in memory. The only case where this had a significant chance of causing problems was an ON COMMIT DELETE ROWS temp table; the other possible paths left bogus state that was unlikely to be used again. Per report from Csaba Nagy.
* Repair an error introduced by log_line_prefix patch: it is not acceptableTom Lane2005-11-05
| | | | | | | | | | | to assume that the string pointer passed to set_ps_display is good forever. There's no need to anyway since ps_status.c itself saves the string, and we already had an API (get_ps_display) to return it. I believe this explains Jim Nasby's report of intermittent crashes in elog.c when %i format code is in use in log_line_prefix. While at it, repair a previously unnoticed problem: on some platforms such as Darwin, the string returned by get_ps_display was blank-padded to the maximum length, meaning that lock.c's attempt to append " waiting" to it never worked.
* Message correctionsPeter Eisentraut2005-10-29
|
* Tweak buffer manager so that 'internal' accesses to a buffer do notTom Lane2005-10-27
| | | | | | | | advance its usage_count. This includes writes of dirty buffers triggered by bgwriter, checkpoint, or FlushRelationBuffers, as well as various corner cases that really ought not count as accesses to the page. Should make for some marginal improvement in the quality of our decisions about when to recycle buffers. Per suggestion from ITAGAKI Takahiro.
* Standard pgindent run for 8.1.Bruce Momjian2005-10-15
|
* Remove an antiquated comment.Neil Conway2005-10-13
|
* Fix another recently-changed place that was messing with spinlock-Tom Lane2005-10-12
| | | | protected data structures and not using a volatile pointer for same.
* Do all accesses to shared buffer headers through volatile-qualifiedTom Lane2005-10-12
| | | | | | | pointers, to ensure that compilers won't rearrange accesses to occur while we're not holding the buffer header spinlock. It's probably not necessary to mark volatile in every single place in bufmgr.c, but better safe than sorry. Per trouble report from Kevin Grittner.
* Add infrastructure for making spins_per_delay variable depending onTom Lane2005-10-11
| | | | | | whether we seem to be running in a uniprocessor or multiprocessor. The adjustment rules could probably still use further tweaking, but I'm convinced this should be a win overall.
* Fix LWLockAssign() so that it can safely be executed after postmasterTom Lane2005-10-07
| | | | initialization. Add spinlocking, fix EXEC_BACKEND unsafeness.
* Allocate a few extra LWLocks for possible use by add-on modules.Tom Lane2005-10-07
| | | | Per request from Marc Munro.
* This patch cleans up the access to members of ItemIdData.Bruce Momjian2005-09-22
| | | | | | It uses existing macros instead of touching directly. ITAGAKI Takahiro
* Print proper cause of statement cancel, user interaction or timeout.Bruce Momjian2005-09-19
|
* Force the size and alignment of LWLock array entries to be either 16 or 32Tom Lane2005-09-16
| | | | | | | bytes. This shouldn't make any difference on x86 machines, where the size happened to be 16 bytes anyway, but on 64-bit machines and machines with slock_t int or wider, it will speed array indexing and hopefully reduce SMP cache contention effects. Per recent experimentation.
* Adjust m68k spinlock code to avoid duplicate in-line and not-in-lineTom Lane2005-08-26
| | | | definitions on recent Linux systems, per Martin Pitt.
* Replace out-of-line tas() assembly code for MIPS with a properlyTom Lane2005-08-25
| | | | constrained GCC inline version. Thiemo Seufer, by way of Martin Pitt.
* 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.
* Add BackendXidGetPid().Tatsuo Ishii2005-08-20
|
* Fix FSM warning to mention increasing max_fsm_pages. Was incorrectlyBruce Momjian2005-08-17
| | | | max_fsm_relations.
* Reverse out Assert addition.Bruce Momjian2005-08-12
|
* Improve documention on loading large data sets into plperl.Bruce Momjian2005-08-12
| | | | David Fetter
* Remove BufferBlockPointers array in favor of a base + (bufnum) * BLCKSZTom Lane2005-08-12
| | | | | | | | computation. On modern machines this is as fast if not faster, and we don't have to clog the CPU's L2 cache with a tens-of-KB pointer array. If we ever decide to adopt a more dynamic allocation method for shared buffers, we'll probably have to revert this patch, but in the meantime we might as well save a few bytes and nanoseconds. Per Qingqing Zhou.
* Solve the problem of OID collisions by probing for duplicate OIDsTom Lane2005-08-12
| | | | | | | whenever we generate a new OID. This prevents occasional duplicate-OID errors that can otherwise occur once the OID counter has wrapped around. Duplicate relfilenode values are also checked for when creating new physical files. Per my recent proposal.
* Avoid useless loop overhead in AtEOXact routines when the backend isTom Lane2005-08-08
| | | | compiled with USE_ASSERT_CHECKING but is running with assert_enabled false.
* Cause ShutdownPostgres to do a normal transaction abort during backendTom Lane2005-08-08
| | | | | | | | exit, instead of trying to take shortcuts. Introduce some additional shutdown callback routines to eliminate kluges like having ProcKill be responsible for shutting down the buffer manager. Ensure that the order of operations during shutdown is predictable and what you would expect given the module layering.
* Fix count_usable_fds() to stop trying to open files once it reachesTom Lane2005-08-07
| | | | | | max_files_per_process. Going further than that is just a waste of cycles, and it seems that current Cygwin does not cope gracefully with deliberately running the system out of FDs. Per Andrew Dunstan.
* Tweak BgBufferSync() so that a persistent write error on a dirty bufferTom Lane2005-08-02
| | | | | | | doesn't block the bgwriter from making progress writing out other buffers. This was a hard problem in the context of the ARC/2Q design, but it's trivial in the context of clock sweep ... just advance the sweep counter before we try to write not after.
* Add NOWAIT option to SELECT FOR UPDATE/SHARE.Tom Lane2005-08-01
| | | | | Original patch by Hans-Juergen Schoenig, revisions by Karel Zak and Tom Lane.
* Add per-user and per-database connection limit options.Tom Lane2005-07-31
| | | | | This patch also includes preliminary update of pg_dumpall for roles. Petr Jelinek, with review by Bruce Momjian and Tom Lane.
* SUNOS4_CC -> SUNOS_CC.Bruce Momjian2005-07-30
|
* Arrange for the postmaster (and standalone backends, initdb, etc) toTom Lane2005-07-04
| | | | | | | | chdir into PGDATA and subsequently use relative paths instead of absolute paths to access all files under PGDATA. This seems to give a small performance improvement, and it should make the system more robust against naive DBAs doing things like moving a database directory that has a live postmaster in it. Per recent discussion.
* Avoid WAL-logging individual tuple insertions during CREATE TABLE ASTom Lane2005-06-20
| | | | | | (a/k/a SELECT INTO). Instead, flush and fsync the whole relation before committing. We do still need the WAL log when PITR is active, however. Simon Riggs and Tom Lane.
* Simplify uses of readdir() by creating a function ReadDir() thatTom Lane2005-06-19
| | | | | | | includes error checking and an appropriate ereport(ERROR) message. This gets rid of rather tedious and error-prone manipulation of errno, as well as a Windows-specific bug workaround, at more than a dozen call sites. After an idea in a recent patch by Heikki Linnakangas.
* Two-phase commit. Original patch by Heikki Linnakangas, with additionalTom Lane2005-06-17
| | | | hacking by Alvaro Herrera and Tom Lane.
* Simplify shared-memory lock data structures as per recent discussion:Tom Lane2005-06-14
| | | | | | | | | | | | | | | | it is sufficient to track whether a backend holds a lock or not, and store information about transaction vs. session locks only in the inside-the-backend LocalLockTable. Since there can now be but one PROCLOCK per lock per backend, LockCountMyLocks() is no longer needed, thus eliminating some O(N^2) behavior when a backend holds many locks. Also simplify the LockAcquire/LockRelease API by passing just a 'sessionLock' boolean instead of a transaction ID. The previous API was designed with the idea that per-transaction lock holding would be important for subtransactions, but now that we have subtransactions we know that this is unwanted. While at it, add an 'isTempObject' parameter to LockAcquire to indicate whether the lock is being taken on a temp table. This is not used just yet, but will be needed shortly for two-phase commit.
* Adjust lo_open() so that specifying INV_READ without INV_WRITE createsTom Lane2005-06-13
| | | | | | | | | | a descriptor that uses the current transaction snapshot, rather than SnapshotNow as it did before (and still does if INV_WRITE is set). This means pg_dump will now dump a consistent snapshot of large object contents, as it never could do before. Also, add a lo_create() function that is similar to lo_creat() but allows the desired OID of the large object to be specified. This will simplify pg_restore considerably (but I'll fix that in a separate commit).
* Modify XLogInsert API to make callers specify whether pages to be backedTom Lane2005-06-06
| | | | | | | | up have the standard layout with unused space between pd_lower and pd_upper. When this is set, XLogInsert will omit the unused space without bothering to scan it to see if it's zero. That saves time in XLogInsert, and also allows reversion of my earlier patch to make PageRepairFragmentation et al explicitly re-zero freed space. Per suggestion by Heikki Linnakangas.
* Remove the mostly-stubbed-out-anyway support routines for WAL UNDO.Tom Lane2005-06-06
| | | | | | That code is never going to be used in the foreseeable future, and where it's more than a stub it's making the redo routines harder to read.
* Change CRCs in WAL records from 64bit to 32bit for performance reasons.Tom Lane2005-06-02
| | | | | | | | | | | | Instead of a separate CRC on each backup block, include backup blocks in their parent WAL record's CRC; this is important to ensure that the backup block really goes with the WAL record, ie there was not a page tear right at the start of the backup block. Implement a simple form of compression of backup blocks: drop any run of zeroes starting at pd_lower, so as not to store the unused 'hole' that commonly exists in PG heap and index pages. Tweak PageRepairFragmentation and related routines to ensure they keep the unused space zeroed, so that the above compression method remains effective. All per recent discussions.
* Improve LockAcquire API per my recent proposal. All error conditionsTom Lane2005-05-29
| | | | | | | | are now reported via elog, eliminating the need to test the result code at most call sites. Make it possible for the caller to distinguish a freshly acquired lock from one already held in the current transaction. Use that capability to avoid redundant AcceptInvalidationMessages() calls in LockRelation().
* Modify hash_search() API to prevent future occurrences of the errorTom Lane2005-05-29
| | | | | | | | | | | | | spotted by Qingqing Zhou. The HASH_ENTER action now automatically fails with elog(ERROR) on out-of-memory --- which incidentally lets us eliminate duplicate error checks in quite a bunch of places. If you really need the old return-NULL-on-out-of-memory behavior, you can ask for HASH_ENTER_NULL. But there is now an Assert in that path checking that you aren't hoping to get that behavior in a palloc-based hash table. Along the way, remove the old HASH_FIND_SAVE/HASH_REMOVE_SAVED actions, which were not being used anywhere anymore, and were surely too ugly and unsafe to want to see revived again.
* Add support for wal_fsync_writethrough for Darwin, and restructure theBruce Momjian2005-05-20
| | | | | | code to better handle writethrough. Chris Campbell
* Update comment that I missed the first time around.Tom Lane2005-05-19
|
* Factor out lock cleanup code that is needed in several places in lock.c.Tom Lane2005-05-19
| | | | | | | | Also, remove the rather useless return value of LockReleaseAll. Change response to detection of corruption in the shared lock tables to PANIC, since that is the only way of cleaning up fully. Originally an idea of Heikki Linnakangas, variously hacked on by Alvaro Herrera and Tom Lane.
* Split the shared-memory array of PGPROC pointers out of the sinvalTom Lane2005-05-19
| | | | | | communication structure, and make it its own module with its own lock. This should reduce contention at least a little, and it definitely makes the code seem cleaner. Per my recent proposal.