Commit Graph

29416 Commits

Author SHA1 Message Date
Heikki Linnakangas 79647eed86 Fix bug in GIN WAL redo cleanup function: don't free fake relcache entry
while it's still being used.

Backpatch to 8.4, where the fake relcache method was introduced.
2010-02-09 20:31:24 +00:00
Magnus Hagander 09c0747515 Typo fix, per Thom Brown 2010-02-09 20:22:20 +00:00
Magnus Hagander a8d3a395aa Define the value for in6addr_any on MingW, since it provides the struct
only in the header files and not in any libraries, yet declare it as
an extern.
2010-02-09 19:55:14 +00:00
Heikki Linnakangas 8740fe7136 Move "Warm Standby Servers for High Availability" and "Hot Standby"
sections under "High Availability, Load Balancing, and Replication"
chapter. Streaming replication chapter needs a lot more work, but this
commit just moves things around.
2010-02-09 16:50:25 +00:00
Michael Meskes c34446cddd First try to make this one ecpg regression test work on Windows too. I'm just trying to figure out the minimal amount of defines needed. 2010-02-09 08:57:13 +00:00
Tom Lane 16e5859cd2 Allow free space map vacuuming to be interrupted. 2010-02-09 00:28:57 +00:00
Tom Lane 95289e4a58 Rearrange lazy-vacuum code a little bit to reduce the window between
truncating the table and transaction commit.  This isn't really making
it safe, but at least there is no good reason to do free space map
cleanup within the risk window.  Don't lock out cancel interrupts
until we have to, either.
2010-02-09 00:28:30 +00:00
Tom Lane d5768dce10 Create an official API function for C functions to use to check if they are
being called as aggregates, and to get the aggregate transition state memory
context if needed.  Use it instead of poking directly into AggState and
WindowAggState in places that shouldn't know so much.

We should have done this in 8.4, probably, but better late than never.

Revised version of a patch by Hitoshi Harada.
2010-02-08 20:39:52 +00:00
Heikki Linnakangas 4d3d2e2b03 Remove obsolete comment about 'fsm' argument, which isn't an argument
anymore.
2010-02-08 19:59:49 +00:00
Tom Lane 9184cc7dab Fix serious performance bug in new implementation of VACUUM FULL:
cluster_rel necessarily builds an all-new toast table, so it's useless to
then go and VACUUM FULL the toast table.
2010-02-08 16:50:21 +00:00
Bruce Momjian dfc902854a Add C comments that HEAP_MOVED_* define usage is only for pre-9.0 binary
upgrades.
2010-02-08 14:10:21 +00:00
Bruce Momjian 3ab41f02ed Update high availability/replication documentation chart for new hot
standby featureset.
2010-02-08 13:41:06 +00:00
Heikki Linnakangas 4cea603128 Remove piece of code to zero out minRecoveryPoint when starting crash
recovery. It's zeroed out whenever a checkpoint is written, so the only
scenario where the removed code did anything is when you kill archive
recovery, remove recovery.conf, and start up the server, so that it goes
into crash recovery instead. That's a "don't do that" scenario, but it
seems better to not clear minRecoveryPoint but instead update it like we
do in archive recovery, which is what will now happen.
2010-02-08 09:08:51 +00:00
Tom Lane 9a75803b1a Remove CatalogCacheFlushRelation, and the reloidattr infrastructure that was
needed by nothing else.

The restructuring I just finished doing on cache management exposed to me how
silly this routine was.  Its function was to go into the catcache and blow
away all entries related to a given relation when there was a relcache flush
on that relation.  However, there is no point in removing a catcache entry
if the catalog row it represents is still valid --- and if it isn't valid,
there must have been a catcache entry flush on it, because that's triggered
directly by heap_update or heap_delete on the catalog row.  So this routine
accomplished nothing except to blow away valid cache entries that we'd very
likely be wanting in the near future to help reconstruct the relcache entry.
Dumb.

On top of which, it required a subtle and easy-to-get-wrong attribute in
syscache definitions, ie, the column containing the OID of the related
relation if any.  Removing that is a very useful maintenance simplification.
2010-02-08 05:53:55 +00:00
Tom Lane 68446b2c87 Remove some more dead VACUUM-FULL-only code. 2010-02-08 05:17:31 +00:00
Tom Lane 0a469c8769 Remove old-style VACUUM FULL (which was known for a little while as
VACUUM FULL INPLACE), along with a boatload of subsidiary code and complexity.
Per discussion, the use case for this method of vacuuming is no longer large
enough to justify maintaining it; not to mention that we don't wish to invest
the work that would be needed to make it play nicely with Hot Standby.

Aside from the code directly related to old-style VACUUM FULL, this commit
removes support for certain WAL record types that could only be generated
within VACUUM FULL, redirect-pointer removal in heap_page_prune, and
nontransactional generation of cache invalidation sinval messages (the last
being the sticking point for Hot Standby).

We still have to retain all code that copes with finding HEAP_MOVED_OFF and
HEAP_MOVED_IN flag bits on existing tuples.  This can't be removed as long
as we want to support in-place update from pre-9.0 databases.
2010-02-08 04:33:55 +00:00
Tom Lane 1ddc2703a9 Work around deadlock problems with VACUUM FULL/CLUSTER on system catalogs,
as per my recent proposal.

First, teach IndexBuildHeapScan to not wait for INSERT_IN_PROGRESS or
DELETE_IN_PROGRESS tuples to commit unless the index build is checking
uniqueness/exclusion constraints.  If it isn't, there's no harm in just
indexing the in-doubt tuple.

Second, modify VACUUM FULL/CLUSTER to suppress reverifying
uniqueness/exclusion constraint properties while rebuilding indexes of
the target relation.  This is reasonable because these commands aren't
meant to deal with corrupted-data situations.  Constraint properties
will still be rechecked when an index is rebuilt by a REINDEX command.

This gets us out of the problem that new-style VACUUM FULL would often
wait for other transactions while holding exclusive lock on a system
catalog, leading to probable deadlock because those other transactions
need to look at the catalogs too.  Although the real ultimate cause of
the problem is a debatable choice to release locks early after modifying
system catalogs, changing that choice would require pretty serious
analysis and is not something to be undertaken lightly or on a tight
schedule.  The present patch fixes the problem in a fairly reasonable
way and should also improve the speed of VACUUM FULL/CLUSTER a little bit.
2010-02-07 22:40:33 +00:00
Tom Lane 1c05b0b4ea Looks like we need #include <sys/stat.h> here on some
platforms.  Per buildfarm.
2010-02-07 22:00:53 +00:00
Tom Lane b9b8831ad6 Create a "relation mapping" infrastructure to support changing the relfilenodes
of shared or nailed system catalogs.  This has two key benefits:

* The new CLUSTER-based VACUUM FULL can be applied safely to all catalogs.

* We no longer have to use an unsafe reindex-in-place approach for reindexing
  shared catalogs.

CLUSTER on nailed catalogs now works too, although I left it disabled on
shared catalogs because the resulting pg_index.indisclustered update would
only be visible in one database.

Since reindexing shared system catalogs is now fully transactional and
crash-safe, the former special cases in REINDEX behavior have been removed;
shared catalogs are treated the same as non-shared.

This commit does not do anything about the recently-discussed problem of
deadlocks between VACUUM FULL/CLUSTER on a system catalog and other
concurrent queries; will address that in a separate patch.  As a stopgap,
parallel_schedule has been tweaked to run vacuum.sql by itself, to avoid
such failures during the regression tests.
2010-02-07 20:48:13 +00:00
Tom Lane 7fc30c488f Avoid changing the sign of zero. Per buildfarm failures. 2010-02-06 05:42:49 +00:00
Bruce Momjian 6ba9b9102a Mention warm and now "hot" standby servers in the high availability docs. 2010-02-05 23:53:22 +00:00
Bruce Momjian 4b113d9cdc Document that archive_timeout will force new WAL files even if a single
checkpoint has happened, and recommend adjusting checkpoint_timeout to
reduce the impact of this.
2010-02-05 23:37:43 +00:00
Bruce Momjian ef51fa505c Add C comment about process_settings() setting order. 2010-02-05 20:26:56 +00:00
Bruce Momjian c1ae9bae7d Previous commit was: Properly document that OVER and WINDOW are Postgres reserved words. 2010-02-05 19:38:21 +00:00
Bruce Momjian d5c861af6c Previous commit was to have tab checking as part of gmake check. 2010-02-05 19:31:18 +00:00
Bruce Momjian 2a93226f0d *** empty log message *** 2010-02-05 19:28:39 +00:00
Bruce Momjian ac9f254684 Improve PL/Perl documentation of database access functions.
Alexey Klyukin
2010-02-05 18:11:46 +00:00
Bruce Momjian cb4bd52ad9 Add SGML 'check-tabs' Makefile rule to check for tabs. 2010-02-05 14:51:50 +00:00
Bruce Momjian 7027aba980 Remove /contrib/isn copyright mention for German Mendez Bravo, with
author's permission.
2010-02-05 04:34:51 +00:00
Bruce Momjian 8283b65019 Rewrite rint() to enable removal of copyright mention; patch from
Nathan Wagner

Function is simpler too.
2010-02-05 03:20:56 +00:00
Joe Conway f419a82c70 Modify recently added PQconnectdbParams() with new argument, expand_dbname.
If expand_dbname is non-zero and dbname contains an = sign, it is taken as
a conninfo string in exactly the same way as if it had been passed to
PQconnectdb. This is equivalent to the way PQsetdbLogin() works, allowing
PQconnectdbParams() to be a complete alternative.

Also improve the way the new function is called from psql and replace a
previously missed call to PQsetdbLogin() in psql. Additionally use
PQconnectdbParams() for pg_dump and friends, and the bin/scripts
command line utilities such as vacuumdb, createdb, etc.

Finally, update the documentation for the new parameter, as well as the
nuances of precedence in cases where key words are repeated or duplicated
in the conninfo string.
2010-02-05 03:09:05 +00:00
Bruce Momjian a141ec13de Rewrite intagg/Makefile from scratch, to avoid copyright mention. 2010-02-05 03:06:30 +00:00
Michael Meskes 58fb345dde Usage of isnan() in ECPG regression tests probably needs '#include <float.h>' as well. 2010-02-04 11:23:29 +00:00
Michael Meskes a96ad2fc74 Streamlined array handling code in libecpg a little bit, in the process fixing yet another incorrect log output. 2010-02-04 09:41:35 +00:00
Tom Lane c00353aa6c Three out of four of us like this phrasing better. 2010-02-04 00:19:28 +00:00
Tom Lane 9727c583fe Restructure CLUSTER/newstyle VACUUM FULL/ALTER TABLE support so that swapping
of old and new toast tables can be done either at the logical level (by
swapping the heaps' reltoastrelid links) or at the physical level (by swapping
the relfilenodes of the toast tables and their indexes).  This is necessary
infrastructure for upcoming changes to support CLUSTER/VAC FULL on shared
system catalogs, where we cannot change reltoastrelid.  The physical swap
saves a few catalog updates too.

We unfortunately have to keep the logical-level swap logic because in some
cases we will be adding or deleting a toast table, so there's no possibility
of a physical swap.  However, that only happens as a consequence of schema
changes in the table, which we do not need to support for system catalogs,
so such cases aren't an obstacle for that.

In passing, refactor the cluster support functions a little bit to eliminate
unnecessarily-duplicated code; and fix the problem that while CLUSTER had
been taught to rename the final toast table at need, ALTER TABLE had not.
2010-02-04 00:09:14 +00:00
Joe Conway fdac8cf998 Check to ensure the number of primary key fields supplied does not
exceed the total number of non-dropped source table fields for
dblink_build_sql_*(). Addresses bug report from Rushabh Lathia.

Backpatch all the way to the 7.3 branch.
2010-02-03 23:01:11 +00:00
Bruce Momjian 73a835eea0 Mention "unquoted" identifiers are case-insensitive. 2010-02-03 22:48:55 +00:00
Bruce Momjian bf62b1a078 Proofreading improvements for the Administration documentation book. 2010-02-03 17:25:06 +00:00
Michael Meskes 1e4cc384ab Fixed some typos in ECPG regression test suite that resulted in regression test failures on some architectures.
By Zoltán Böszörményi.
2010-02-03 13:56:27 +00:00
Heikki Linnakangas 9de778b24b Move the responsibility of writing a "unlogged WAL operation" record from
heap_sync() to the callers, because heap_sync() is sometimes called even
if the operation itself is WAL-logged. This eliminates the bogus unlogged
records from CLUSTER that Simon Riggs reported, patch by Fujii Masao.
2010-02-03 10:01:30 +00:00
Heikki Linnakangas 808969d0e7 Add a message type header to the CopyData messages sent from primary
to standby in streaming replication. While we only have one message type
at the moment, adding a message type header makes this easier to extend.
2010-02-03 09:47:19 +00:00
Tom Lane 47c5b8f558 Fix unwarranted assumption that a cached rowtype would stick around
for the lifespan of the CreateStmt.  Per buildfarm member jaguar.
2010-02-03 05:46:37 +00:00
Tom Lane 45c88a55c2 Add #include <float.h> --- guessing the lack of this is why Windows
machines are all rejecting isinf() calls in this file.
2010-02-03 03:25:55 +00:00
Tom Lane 98e314550c Fix timing-sensitive regression test result I just created :-( --- the
DROP USER at the end of the cluster.sql test could fail, if the temp
table created in the previous session hadn't finished getting dropped.
Unluckily, I didn't see this in several repetitions of the parallel
regression tests, but it's popping up on quite a few buildfarm machines.
2010-02-03 03:21:25 +00:00
Tom Lane 70a2b05a59 Assorted cleanups in preparation for using a map file to support altering
the relfilenode of currently-not-relocatable system catalogs.

1. Get rid of inval.c's dependency on relfilenode, by not having it emit
smgr invalidations as a result of relcache flushes.  Instead, smgr sinval
messages are sent directly from smgr.c when an actual relation delete or
truncate is done.  This makes considerably more structural sense and allows
elimination of a large number of useless smgr inval messages that were
formerly sent even in cases where nothing was changing at the
physical-relation level.  Note that this reintroduces the concept of
nontransactional inval messages, but that's okay --- because the messages
are sent by smgr.c, they will be sent in Hot Standby slaves, just from a
lower logical level than before.

2. Move setNewRelfilenode out of catalog/index.c, where it never logically
belonged, into relcache.c; which is a somewhat debatable choice as well but
better than before.  (I considered catalog/storage.c, but that seemed too
low level.)  Rename to RelationSetNewRelfilenode.

3. Cosmetic cleanups of some other relfilenode manipulations.
2010-02-03 01:14:17 +00:00
Tom Lane ab7c49c988 Fix assorted poorly-thought-out message strings: use %u not %d for printing
OIDs, avoid random line breaks in strings somebody might grep for.
2010-02-02 22:01:53 +00:00
Tom Lane c98157d693 CLUSTER specified the wrong namespace when renaming toast tables of temporary
relations (they don't live in pg_toast).  This caused an Assert failure in
assert-enabled builds.  So far as I can see, in a non-assert build it would
only have messed up the checks for conflicting names, so a failure would be
quite improbable but perhaps not impossible.
2010-02-02 19:12:29 +00:00
Magnus Hagander 0a27347141 Make RADIUS authentication use pg_getaddrinfo_all() to get address of
the server.

Gets rid of a fairly ugly hack for Solaris, and also provides hostname
and IPV6 support.
2010-02-02 19:09:37 +00:00
Robert Haas d8db6a6096 Fold FindConversion() into FindConversionByName() and remove ACL check.
All callers of FindConversionByName() already do suitable permissions
checking already apart from this function, but this is not just dead
code removal: the unnecessary permissions check can actually lead to
spurious failures - there's no reason why inability to execute the
underlying function should prohibit renaming the conversion, for example.
(The error messages in these cases were also rather poor:
FindConversion would return InvalidOid, eventually leading to a complaint
that the conversion "did not exist", which was not correct.)

KaiGai Kohei
2010-02-02 18:52:33 +00:00