aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
Commit message (Collapse)AuthorAge
...
* Code review for HeapTupleHeader changes. Add version number to page headersTom Lane2002-09-02
| | | | | | | | | | (overlaying low byte of page size) and add HEAP_HASOID bit to t_infomask, per earlier discussion. Simplify scheme for overlaying fields in tuple header (no need for cmax to live in more than one place). Don't try to clear infomask status bits in tqual.c --- not safe to do it there. Don't try to force output table of a SELECT INTO to have OIDs, either. Get rid of unnecessarily complex three-state scheme for TupleDesc.tdhasoids, which has already caused one recent failure. Improve documentation.
* Code review of CLUSTER patch. Clean up problems with relcache gettingTom Lane2002-08-11
| | | | confused, toasted data getting lost, etc.
* Restructure local-buffer handling per recent pghackers discussion.Tom Lane2002-08-06
| | | | | | | | | | | | | | The local buffer manager is no longer used for newly-created relations (unless they are TEMP); a new non-TEMP relation goes through the shared bufmgr and thus will participate normally in checkpoints. But TEMP relations use the local buffer manager throughout their lifespan. Also, operations in TEMP relations are not logged in WAL, thus improving performance. Since it's no longer necessary to fsync relations as they move out of the local buffers into shared buffers, quite a lot of smgr.c/md.c/fd.c code is no longer needed and has been removed: there's no concept of a dirty relation anymore in md.c/fd.c, and we never fsync anything but WAL. Still TODO: improve local buffer management algorithms so that it would be reasonable to increase NLocBuffer.
* Fix obsolete comment.Tom Lane2002-08-04
|
* When compiling with --enable-cassert, check for reference count leaksTom Lane2002-08-02
| | | | | | | in the relcache. It's rather silly that we have reference count leak checks in bufmgr and in catcache, but not in relcache which will normally have many fewer entries. Chris K-L would have caught at least one bug in his recent DROP patch if he'd had this.
* oid is needed, it is added at the end of the struct (after the nullBruce Momjian2002-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bitmap, if present). Per Tom Lane's suggestion the information whether a tuple has an oid or not is carried in the tuple descriptor. For debugging reasons tdhasoid is of type char, not bool. There are predefined values for WITHOID, WITHOUTOID and UNDEFOID. This patch has been generated against a cvs snapshot from last week and I don't expect it to apply cleanly to current sources. While I post it here for public review, I'm working on a new version against a current snapshot. (There's been heavy activity recently; hope to catch up some day ...) This is a long patch; if it is too hard to swallow, I can provide it in smaller pieces: Part 1: Accessor macros Part 2: tdhasoid in TupDesc Part 3: Regression test Part 4: Parameter withoid to heap_addheader Part 5: Eliminate t_oid from HeapTupleHeader Part 2 is the most hairy part because of changes in the executor and even in the parser; the other parts are straightforward. Up to part 4 the patched postmaster stays binary compatible to databases created with an unpatched version. Part 5 is small (100 lines) and finally breaks compatibility. Manfred Koizar
* Improve relcache.c error reporting for the next guy who has to debugBruce Momjian2002-07-15
| | | | this thing.
* Second phase of committing Rod Taylor's pg_depend/pg_constraint patch.Tom Lane2002-07-12
| | | | | | | | | | | | pg_relcheck is gone; CHECK, UNIQUE, PRIMARY KEY, and FOREIGN KEY constraints all have real live entries in pg_constraint. pg_depend exists, and RESTRICT/CASCADE options work on most kinds of DROP; however, pg_depend is not yet very well populated with dependencies. (Most of the ones that are present at this point just replace formerly hardwired associations, such as the implicit drop of a relation's pg_type entry when the relation is dropped.) Need to add more logic to create dependency entries, improve pg_dump to dump constraints in place of indexes and triggers, and add some regression tests.
* Update copyright to 2002.Bruce Momjian2002-06-20
|
* Make RelationForgetRelation error out if the relcache entry has nonzeroTom Lane2002-05-22
| | | | | reference count. This avoids leaving dangling pointers around, as in recent bug report against sequences (bug# 671).
* Support toasting of shared system relations, and provide toast tables forTom Lane2002-04-27
| | | | | | | | | pg_database, pg_shadow, pg_group, all of which now have potentially-long fields. Along the way, get rid of SharedSystemRelationNames list: shared rels are now identified in their include/pg_catalog/*.h files by a BKI_SHARED_RELATION macro, while indexes and toast rels inherit sharedness automatically from their parent table. Fix some bugs with failure to detoast pg_group.grolist during ALTER GROUP.
* pg_trigger's index on tgrelid is replaced by a unique index onTom Lane2002-04-19
| | | | | | | | | | (tgrelid, tgname). This provides an additional check on trigger name uniqueness per-table (which was already enforced by the code anyway). With this change, RelationBuildTriggers will read the triggers in order by tgname, since it's scanning using this index. Since a predictable trigger ordering has been requested for some time, document this behavior as a feature. Also document that rules fire in name order, since yesterday's changes to pg_rewrite indexing cause that too.
* Rule names are now unique per-relation, rather than unique globally.Tom Lane2002-04-18
| | | | | | | | DROP RULE and COMMENT ON RULE syntax adds an 'ON tablename' clause, similar to TRIGGER syntaxes. To allow loading of existing pg_dump files containing COMMENT ON RULE, the COMMENT code will still accept the old syntax --- but only if the target rulename is unique across the whole database.
* Checking to decide whether relations are system relations now dependsTom Lane2002-04-12
| | | | | on the namespace not the name; pg_ is not a reserved prefix for table names anymore. From Fernando Nasser.
* Reimplement temp tables using schemas. The temp table map is history;Tom Lane2002-03-31
| | | | temp table entries in pg_class have the names the user would expect.
* pg_class has a relnamespace column. You can create and access tablesTom Lane2002-03-26
| | | | | | in schemas other than the system namespace; however, there's no search path yet, and not all operations work yet on tables outside the system namespace.
* Add DOMAIN support. Includes manual pages and regression tests, fromBruce Momjian2002-03-19
| | | | Rod Taylor.
* Back out domain patch until it works properly.Bruce Momjian2002-03-07
|
* Ok. Updated patch attached.Bruce Momjian2002-03-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - domain.patch -> source patch against pgsql in cvs - drop_domain.sgml and create_domain.sgml -> New doc/src/sgml/ref docs - dominfo.txt -> basic domain related queries I used for testing [ ADDED TO /doc] Enables domains of array elements -> CREATE DOMAIN dom int4[3][2]; Uses a typbasetype column to describe the origin of the domain. Copies data to attnotnull rather than processing in execMain(). Some documentation differences from earlier. If this is approved, I'll start working on pg_dump, and a \dD <domain> option in psql, and regression tests. I don't really feel like doing those until the system table structure settles for pg_type. CHECKS when added, will also be copied to to the table attributes. FK Constraints (if I ever figure out how) will be done similarly. Both will lbe handled by MergeDomainAttributes() which is called shortly before MergeAttributes(). Rod Taylor
* Change made to elog:Bruce Momjian2002-03-06
| | | | | | | | | | | | | | | | | | | o Change all current CVS messages of NOTICE to WARNING. We were going to do this just before 7.3 beta but it has to be done now, as you will see below. o Change current INFO messages that should be controlled by client_min_messages to NOTICE. o Force remaining INFO messages, like from EXPLAIN, VACUUM VERBOSE, etc. to always go to the client. o Remove INFO from the client_min_messages options and add NOTICE. Seems we do need three non-ERROR elog levels to handle the various behaviors we need for these messages. Regression passed.
* Catcaches can now store negative entries as well as positive ones, toTom Lane2002-03-03
| | | | | | | | | | speed up repetitive failed searches; per pghackers discussion in late January. inval.c logic substantially simplified, since we can now treat inserts and deletes alike as far as inval events are concerned. Some repair work needed in heap_create_with_catalog, which turns out to have been doing CommandCounterIncrement at a point where the new relation has non-self-consistent catalog entries. With the new inval code, that resulted in assert failures during a relcache entry rebuild.
* A bunch of changes aimed at reducing backend startup time...Tom Lane2002-02-19
| | | | | | | | | | | | | | | | | | | | | | | | | | Improve 'pg_internal.init' relcache entry preload mechanism so that it is safe to use for all system catalogs, and arrange to preload a realistic set of system-catalog entries instead of only the three nailed-in-cache indexes that were formerly loaded this way. Fix mechanism for deleting out-of-date pg_internal.init files: this must be synchronized with transaction commit, not just done at random times within transactions. Drive it off relcache invalidation mechanism so that no special-case tests are needed. Cache additional information in relcache entries for indexes (their pg_index tuples and index-operator OIDs) to eliminate repeated lookups. Also cache index opclass info at the per-opclass level to avoid repeated lookups during relcache load. Generalize 'systable scan' utilities originally developed by Hiroshi, move them into genam.c, use in a number of places where there was formerly ugly code for choosing either heap or index scan. In particular this allows simplification of the logic that prevents infinite recursion between syscache and relcache during startup: we can easily switch to heapscans in relcache.c when and where needed to avoid recursion, so IndexScanOK becomes simpler and does not need any expensive initialization. Eliminate useless opening of a heapscan data structure while doing an indexscan (this saves an mdnblocks call and thus at least one kernel call).
* Fix init_irels to close the pg_internal.init file before returning.Tom Lane2002-01-16
| | | | | | This saves one open file descriptor per backend, and avoids an annoying NOTICE on Cygwin (which has trouble deleting open files). Bug appears to date back to original coding of init_irels, circa 1992.
* If we fail to rename pg_internal.init into place, delete the uselessTom Lane2002-01-15
| | | | | temporary file. This seems to be a known failure mode under Cygwin, so we might as well expend the extra line of code to be tidy.
* New pgindent run with fixes suggested by Tom. Patch manually reviewed,Bruce Momjian2001-11-05
| | | | initdb/regression tests pass.
* Another pgindent run. Fixes enum indenting, and improves #endifBruce Momjian2001-10-28
| | | | spacing. Also adds space for one-line comments.
* pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian2001-10-25
| | | | tests pass.
* Rearrange fmgr.c and relcache so that it's possible to keep FmgrInfoTom Lane2001-10-06
| | | | | | | | | lookup info in the relcache for index access method support functions. This makes a huge difference for dynamically loaded support functions, and should save a few cycles even for built-in ones. Also tweak dfmgr.c so that load_external_function is called only once, not twice, when doing fmgr_info for a dynamically loaded function. All per performance gripe from Teodor Sigaev, 5-Oct-01.
* Further cleanup of dynahash.c API, in pursuit of portability andTom Lane2001-10-05
| | | | | | | | | readability. Bizarre '(long *) TRUE' return convention is gone, in favor of just raising an error internally in dynahash.c when we detect hashtable corruption. HashTableWalk is gone, in favor of using hash_seq_search directly, since it had no hope of working with non-LONGALIGNable datatypes. Simplify some other code that was made undesirably grotty by promixity to HashTableWalk.
* Another round of cleanups for dynahash.c (maybe it's finally clean ofTom Lane2001-10-01
| | | | | | | | | portability issues). Caller-visible data structures are now allocated on MAXALIGN boundaries, allowing safe use of datatypes wider than 'long'. Rejigger hash_create API so that caller specifies size of key and total size of entry, not size of key and size of rest of entry. This simplifies life considerably since each number is just a sizeof(), and padding issues etc. are taken care of automatically.
* Replace implementation of pg_log as a relation accessed through theTom Lane2001-08-25
| | | | | | | | | | | buffer manager with 'pg_clog', a specialized access method modeled on pg_xlog. This simplifies startup (don't need to play games to open pg_log; among other things, OverrideTransactionSystem goes away), should improve performance a little, and opens the door to recycling commit log space by removing no-longer-needed segments of the commit log. Actual recycling is not there yet, but I felt I should commit this part separately since it'd still be useful if we chose not to do transaction ID wraparound.
* Make OIDs optional, per discussions in pghackers. WITH OIDS is still theTom Lane2001-08-10
| | | | | | | | | | | | default, but OIDS are removed from many system catalogs that don't need them. Some interesting side effects: TOAST pointers are 20 bytes not 32 now; pg_description has a three-column key instead of one. Bugs fixed in passing: BINARY cursors work again; pg_class.relhaspkey has some usefulness; pg_dump dumps comments on indexes, rules, and triggers in a valid order. initdb forced.
* Further work on connecting the free space map (which is still just aTom Lane2001-06-29
| | | | | | | | stub) into the rest of the system. Adopt a cleaner approach to preventing deadlock in concurrent heap_updates: allow RelationGetBufferForTuple to select any page of the rel, and put the onus on it to lock both buffers in a consistent order. Remove no-longer-needed isExtend hack from API of ReleaseAndReadBuffer.
* Install infrastructure for shared-memory free space map. Doesn't actuallyTom Lane2001-06-27
| | | | | | | | | do anything yet, but it has the necessary connections to initialization and so forth. Make some gestures towards allowing number of blocks in a relation to be BlockNumber, ie, unsigned int, rather than signed int. (I doubt I got all the places that are sloppy about it, yet.) On the way, replace the hardwired NLOCKS_PER_XACT fudge factor with a GUC variable.
* Statistical system views (yet without the config stuff, butJan Wieck2001-06-22
| | | | | | | it's hard to keep such massive changes in sync with the tree so I need to get it in and work from there now). Jan
* Do some restructuring to improve performance of the catcaches. TeachTom Lane2001-06-18
| | | | | | | | | | | | | | | | | CatalogCacheFlushRelation (formerly called SystemCacheRelationFlushed) how to distinguish tuples it should flush from those it needn't; this means a relcache flush event now only removes the catcache entries it ought to, rather than zapping the caches completely as it used to. Testing with the regression tests indicates that this considerably improves the lifespan of catcache entries. Also, rearrange catcache data structures so that the limit on number of cached tuples applies globally across all the catcaches, rather than being per-catcache. It was a little silly to have the same size limit on both, say, pg_attribute caches and pg_am caches (there being only four possible rows in the latter...). Doing LRU removal across all the caches instead of locally in each one should reduce cache reload traffic in the more heavily used caches and improve the efficiency of cache memory use.
* Clean up various to-do items associated with system indexes:Tom Lane2001-06-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pg_database now has unique indexes on oid and on datname. pg_shadow now has unique indexes on usename and on usesysid. pg_am now has unique index on oid. pg_opclass now has unique index on oid. pg_amproc now has unique index on amid+amopclaid+amprocnum. Remove pg_rewrite's unnecessary index on oid, delete unused RULEOID syscache. Remove index on pg_listener and associated syscache for performance reasons (caching rows that are certain to change before you need 'em again is rather pointless). Change pg_attrdef's nonunique index on adrelid into a unique index on adrelid+adnum. Fix various incorrect settings of pg_class.relisshared, make that the primary reference point for whether a relation is shared or not. IsSharedSystemRelationName() is now only consulted to initialize relisshared during initial creation of tables and indexes. In theory we might now support shared user relations, though it's not clear how one would get entries for them into pg_class &etc of multiple databases. Fix recently reported bug that pg_attribute rows created for an index all have the same OID. (Proof that non-unique OID doesn't matter unless it's actually used to do lookups ;-)) There's no need to treat pg_trigger, pg_attrdef, pg_relcheck as bootstrap relations. Convert them into plain system catalogs without hardwired entries in pg_class and friends. Unify global.bki and template1.bki into a single init script postgres.bki, since the alleged distinction between them was misleading and pointless. Not to mention that it didn't work for setting up indexes on shared system relations. Rationalize locking of pg_shadow, pg_group, pg_attrdef (no need to use AccessExclusiveLock where ExclusiveLock or even RowExclusiveLock will do). Also, hold locks until transaction commit where necessary.
* Clean up some minor problems exposed by further thought about Panon's bugTom Lane2001-06-01
| | | | | | | | | | | | | | report on old-style functions invoked by RI triggers. We had a number of other places that were being sloppy about which memory context FmgrInfo subsidiary data will be allocated in. Turns out none of them actually cause a problem in 7.1, but this is for arcane reasons such as the fact that old-style triggers aren't supported anyway. To avoid getting burnt later, I've restructured the trigger support so that we don't keep trigger FmgrInfo structs in relcache memory. Some other related cleanups too: it's not really necessary to call fmgr_info at all while setting up the index support info in relcache entries, because those ScanKeyEntry structs are never used to invoke the functions. This should speed up relcache initialization a tiny bit.
* Remove SEP_CHAR, replace with / or '/' as appropriate.Bruce Momjian2001-05-30
|
* Small include file fix for pg_variabie.hBruce Momjian2001-05-14
|
* Remove columns pg_index.haskeytype and pg_index.indisclustered. Not used.Bruce Momjian2001-05-14
|
* Remove unused tables pg_variable, pg_inheritproc, pg_ipl tables. InitdbBruce Momjian2001-05-14
| | | | forced.
* Restore pre-7.1 behavior of allowing DROP of a table whose underlyingTom Lane2001-04-02
| | | | | | physical file has disappeared. There is no really good reason why relcache should be opening the underlying file at all, AFAICS. In any case we needn't raise a hard error here.
* Fix comments that were mis-wrapped, for Tom Lane.Bruce Momjian2001-03-23
|
* pgindent run. Make it all clean.Bruce Momjian2001-03-22
|
* Change /*---- commants to /* where appropriate. pgindent will tightenBruce Momjian2001-02-22
| | | | up the comments later.
* Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian2001-01-24
|
* Add some debugging support code (ifdef'd out in normal use).Tom Lane2001-01-08
|
* Fix memory leak in relcache handling of rules: allocate rule parsetreesTom Lane2001-01-06
| | | | | | in per-entry sub-memory-context, where they were supposed to go, rather than in CacheMemoryContext where the code was putting them. Must've suffered a severe brain fade when I wrote this :-(
* init_irels() is changed to be called in RelationCacheInitializePhase2()Hiroshi Inoue2001-01-06
| | | | so that transactional control could guarantee the consistency.