aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer/bufmgr.c
Commit message (Collapse)AuthorAge
* Change s_lock to not use any zero-delay select() calls; these are just aTom Lane2001-02-18
| | | | | | | | | | waste of cycles on single-CPU machines, and of dubious utility on multi-CPU machines too. Tweak s_lock_stuck so that caller can specify timeout interval, and increase interval before declaring stuck spinlock for buffer locks and XLOG locks. On systems that have fdatasync(), use that rather than fsync() to sync WAL log writes. Ensure that WAL file is entirely allocated during XLogFileInit.
* Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian2001-01-24
|
* Make critical sections (elog->crash) and interrupt holdoff sectionsTom Lane2001-01-19
| | | | into distinct concepts, per recent discussion on pghackers.
* Restructure backend SIGINT/SIGTERM handling so that 'die' interruptsTom Lane2001-01-14
| | | | | | | are treated more like 'cancel' interrupts: the signal handler sets a flag that is examined at well-defined spots, rather than trying to cope with an interrupt that might happen anywhere. See pghackers discussion of 1/12/01.
* Add more critical-section calls: all code sections that hold spinlocksTom Lane2001-01-12
| | | | | | | | | | | are now critical sections, so as to ensure die() won't interrupt us while we are munging shared-memory data structures. Avoid insecure intermediate states in some code that proc_exit will call, like palloc/pfree. Rename START/END_CRIT_CODE to START/END_CRIT_SECTION, since that seems to be what people tend to call them anyway, and make them be called with () like a function call, in hopes of not confusing pg_indent. I doubt that this is sufficient to make SIGTERM safe anywhere; there's just too much code that could get invoked during proc_exit().
* LockBuffer should not elog while holding buffer's cntx_lock.Tom Lane2001-01-08
|
* Fix failure in CreateCheckPoint on some Alpha boxes --- it's not OK toTom Lane2000-12-29
| | | | | | | assume that TAS() will always succeed the first time, even if the lock is known to be free. Also, make sure that code will eventually time out and report a stuck spinlock, rather than looping forever. Small cleanups in s_lock.h, too.
* New WAL version - CRC and data blocks backup.Vadim B. Mikheev2000-12-28
|
* Avoid XLogFlush for clean buffers in BufferSync.Vadim B. Mikheev2000-12-22
|
* Hope that this is valid localbuf.c versionVadim B. Mikheev2000-11-30
|
* No more #ifdef XLOG.Vadim B. Mikheev2000-11-30
|
* Rearrange bufmgr header files so that buf_internals.h need not beTom Lane2000-11-30
| | | | | | | included by everything that includes bufmgr.h --- it's supposed to be internals, after all, not part of the API! This fixes the conflict against FreeBSD headers reported by Rosenman, by making it unnecessary for s_lock.h to be included by plperl.c.
* Significant cleanups in SysV IPC handling (shared mem and semaphores).Tom Lane2000-11-28
| | | | | | | | | | | IPC key assignment will now work correctly even when multiple postmasters are using same logical port number (which is possible given -k switch). There is only one shared-mem segment per postmaster now, not 3. Rip out broken code for non-TAS case in bufmgr and xlog, substitute a complete S_LOCK emulation using semaphores in spin.c. TAS and non-TAS logic is now exactly the same. When deadlock is detected, "Deadlock detected" is now the elog(ERROR) message, rather than a NOTICE that comes out before an unhelpful ERROR.
* Include postgres.h before checking #ifdef XLOG.Peter Eisentraut2000-11-20
|
* Make DROP TABLE rollback-able: postpone physical file delete until commit.Tom Lane2000-11-08
| | | | | | | | | (WAL logging for this is not done yet, however.) Clean up a number of really crufty things that are no longer needed now that DROP behaves nicely. Make temp table mapper do the right things when drop or rename affecting a temp table is rolled back. Also, remove "relation modified while in use" error check, in favor of locking tables at first reference and holding that lock throughout the statement.
* WALVadim B. Mikheev2000-10-28
|
* New relcache hash table with RelFileNode as key to be usedVadim B. Mikheev2000-10-23
| | | | | | | from bufmgr - it would be nice to have separate hash in smgr for node <--> fd mappings, but for the moment it's easy to add new hash to relcache. Fixed small bug in xlog.c:ReadRecord.
* Fix incorrect logic for clearing BufferDirtiedByMe in ReleaseRelationBuffersTom Lane2000-10-22
| | | | | | | | | and DropBuffers. Formerly we cleared the flag for each buffer currently belonging to the target rel or database, but that's completely wrong! Must look at BufferTagLastDirtied to see whether the BufferDirtiedByMe flag is relevant to target rel or not; this is *independent* of the current contents of the buffer. Vadim spotted this problem, but his fix was only partially correct...
* WALVadim B. Mikheev2000-10-21
|
* redo/undo support functions and cleanups.Vadim B. Mikheev2000-10-20
|
* I had to change buffer tag: now RelFileNode is used instead ofVadim B. Mikheev2000-10-18
| | | | | LockRelId - ie physical information, not logical. It's required for WAL. Regression tests passed.
* New file naming. Database OID is used as "tablespace" id andVadim B. Mikheev2000-10-16
| | | | | relation OID is used as file node on creation but may be changed later if required. Regression Tests Approved (c) -:)))
* BufferAlloc() doesn't allocate write error buffers.Hiroshi Inoue2000-09-29
| | | | Remove compiler waring(my fault).
* avoid database-wide restart on write errorHiroshi Inoue2000-09-29
|
* Acquire read lock on a buffer while writing it out, to preventTom Lane2000-09-25
| | | | concurrent modifications to the page by other backends.
* Mark functions as static and ifdef NOT_USED as appropriate.Bruce Momjian2000-06-08
|
* Revise FlushRelationBuffers/ReleaseRelationBuffers per discussion withTom Lane2000-05-19
| | | | | | | | | | | | | | | | | | | | | Hiroshi. ReleaseRelationBuffers now removes rel's buffers from pool, instead of merely marking them nondirty. The old code would leave valid buffers for a deleted relation, which didn't cause any known problems but can't possibly be a good idea. There were several places which called ReleaseRelationBuffers *and* FlushRelationBuffers, which is now unnecessary; but there were others that did not. FlushRelationBuffers no longer emits a warning notice if it finds dirty buffers to flush, because with the current bufmgr behavior that's not an unexpected condition. Also, FlushRelationBuffers will flush out all dirty buffers for the relation regardless of block number. This ensures that pg_upgrade's expectations are met about tuple on-row status bits being up-to-date on disk. Lastly, tweak BufTableDelete() to clear the buffer's tag so that no one can mistake it for being a still-valid buffer for the page it once held. Formerly, the buffer would not be found by buffer hashtable searches after BufTableDelete(), but it would still be thought to belong to its old relation by the routines that sequentially scan the shared-buffer array. Again I know of no bugs caused by that, but it still can't be a good idea.
* Ye-old pgindent run. Same 4-space tabs.Bruce Momjian2000-04-12
|
* Tweak smgrblindwrt per advice from Vadim: add parameter indicatingTom Lane2000-04-10
| | | | | | whether to do fsync or not, and if so (which should be seldom) just do the fsync immediately. This way we need not build data structures in md.c/fd.c for blind writes.
* Buffer manager modifications to keep a local buffer-dirtied bit as wellTom Lane2000-04-09
| | | | | | | | as a shared dirtybit for each shared buffer. The shared dirtybit still controls writing the buffer, but the local bit controls whether we need to fsync the buffer's file. This arrangement fixes a bug that allowed some required fsyncs to be missed, and should improve performance as well. For more info see my post of same date on pghackers.
* Get rid of SetBufferWriteMode(), which was an accident waiting to happen.Tom Lane2000-03-31
| | | | | | | | In the event of an elog() while the mode was set to immediate write, there was no way for it to be set back to the normal delayed write. The mechanism was a waste of space and cycles anyway, since the only user was varsup.c, which could perfectly well call FlushBuffer directly. Now it does just that, and the notion of a write mode is gone.
* Marginal performance improvement in LockBuffer --- calculate addressTom Lane2000-03-14
| | | | | | of BufferLocks[] entry just once. Seems to save 10% or so of the routine's runtime, which'd not be worth worrying about if it weren't such a hotspot.
* Oops, commited a test version of this file by accident. Revert.Tom Lane2000-02-21
|
* Change parse-time representation of float literals (which include oversizeTom Lane2000-02-21
| | | | | | | | integers) to be strings instead of 'double'. We convert from string form to internal representation only after type resolution has determined the correct type for the constant. This eliminates loss-of-precision worries and gets rid of the change in behavior seen at 17 digits with the previous kluge.
* Fix assert bug(was my fault)Hiroshi Inoue2000-02-17
|
* Add:Bruce Momjian2000-01-26
| | | | | | * Portions Copyright (c) 1996-2000, PostgreSQL, Inc to all files copyright Regents of Berkeley. Man, that's a lot of files.
* Fix for TODO item * spinlock stuck problem when elog(FATAL)Hiroshi Inoue2000-01-17
| | | | and elog(ERROR) inside bufmgr.
* Fixed all elog related warnings, as well as a few others.Peter Eisentraut2000-01-15
|
* Fix it's and its to be correct.Bruce Momjian2000-01-05
|
* Come to think of it, DropBuffers() could have the same problem asTom Lane1999-11-22
| | | | | ReleaseRelationBuffers --- need to wait if anyone is trying to flush out that buffer.
* ReleaseRelationBuffers() failed to check for I/O in progress on a bufferTom Lane1999-11-22
| | | | | | | it wants to release. This leads to a race condition: does the backend that's trying to flush the buffer do so before the one that's deleting the relation does so? Usually no problem, I expect, but on occasion this could lead to hard-to-reproduce complaints from md.c, especially mdblindwrt.
* Commit to make clearer distinction for temp names and real names.Bruce Momjian1999-11-16
| | | | Thanks to Tom Lane for ideas.
* New NameStr macro to convert Name to Str. No need for var.data anymore.Bruce Momjian1999-11-07
| | | | | | Fewer calls to nameout. Better use of RelationGetRelationName.
* Make tree compilable (+WAL).Vadim B. Mikheev1999-09-28
|
* Several changes here, not very related but touching some of the same files.Tom Lane1999-09-24
| | | | | | | | | | | | | | | | | | | | | * Buffer refcount cleanup (per my "progress report" to pghackers, 9/22). * Add links to backend PROC structs to sinval's array of per-backend info, and use these links for routines that need to check the state of all backends (rather than the slow, complicated search of the ShmemIndex hashtable that was used before). Add databaseOID to PROC structs. * Use this to implement an interlock that prevents DESTROY DATABASE of a database containing running backends. (It's a little tricky to prevent a concurrently-starting backend from getting in there, since the new backend is not able to lock anything at the time it tries to look up its database in pg_database. My solution is to recheck that the DB is OK at the end of InitPostgres. It may not be a 100% solution, but it's a lot better than no interlock at all...) * In ALTER TABLE RENAME, flush buffers for the relation before doing the rename of the physical files, to ensure we don't get failures later from mdblindwrt(). * Update TRUNCATE patch so that it actually compiles against current sources :-(. You should do "make clean all" after pulling these changes.
* Mega-commit to make heap_open/heap_openr/heap_close take anTom Lane1999-09-18
| | | | | | | | | | | | | | | | | additional argument specifying the kind of lock to acquire/release (or 'NoLock' to do no lock processing). Ensure that all relations are locked with some appropriate lock level before being examined --- this ensures that relevant shared-inval messages have been processed and should prevent problems caused by concurrent VACUUM. Fix several bugs having to do with mismatched increment/decrement of relation ref count and mismatched heap_open/close (which amounts to the same thing). A bogus ref count on a relation doesn't matter much *unless* a SI Inval message happens to arrive at the wrong time, which is probably why we got away with this sloppiness for so long. Repair missing grab of AccessExclusiveLock in DROP TABLE, ALTER/RENAME TABLE, etc, as noted by Hiroshi. Recommend 'make clean all' after pulling this update; I modified the Relation struct layout slightly. Will post further discussion to pghackers list shortly.
* Move some system includes into c.h, and remove duplicates.Bruce Momjian1999-07-17
|
* Final cleanup.Bruce Momjian1999-07-16
|
* Update #include cleanupsBruce Momjian1999-07-16
|
* Remove unused #includes in *.c files.Bruce Momjian1999-07-15
|