OSDN Git Service

pg-rex/syncrep.git
13 years agoSilence compiler warning about uninitialized variable, noted by
Heikki Linnakangas [Mon, 24 Jan 2011 06:28:00 +0000 (08:28 +0200)]
Silence compiler warning about uninitialized variable, noted by
Itagaki Takahiro

13 years agoPGXS support for contrib/hstore
Robert Haas [Mon, 24 Jan 2011 04:07:55 +0000 (23:07 -0500)]
PGXS support for contrib/hstore

Joey Adams

13 years agoBlind attempt to exclude sepgsql from MSVC build system.
Robert Haas [Mon, 24 Jan 2011 03:57:32 +0000 (22:57 -0500)]
Blind attempt to exclude sepgsql from MSVC build system.

13 years agoFirst round of cleanup of sepgsql code and documentation.
Robert Haas [Mon, 24 Jan 2011 03:47:16 +0000 (22:47 -0500)]
First round of cleanup of sepgsql code and documentation.

Robert Haas, with a few suggestions from Thom Brown

13 years agosepgsql, an SE-Linux integration for PostgreSQL
Robert Haas [Mon, 24 Jan 2011 01:44:48 +0000 (20:44 -0500)]
sepgsql, an SE-Linux integration for PostgreSQL

This is still pretty rough - among other things, the documentation
needs work, and the messages need a visit from the style police -
but this gets the basic framework in place.

KaiGai Kohei

13 years agoMake walsender options order-independent
Magnus Hagander [Sun, 23 Jan 2011 22:39:18 +0000 (23:39 +0100)]
Make walsender options order-independent

While doing this, also move base backup options into
a struct instead of increasing the number of parameters
to multiple functions for each new option.

13 years agoReorder includes to unbreak MSVC
Magnus Hagander [Sun, 23 Jan 2011 21:44:07 +0000 (22:44 +0100)]
Reorder includes to unbreak MSVC

13 years agoAdd 'directory' format to pg_dump. The new directory format is compatible
Heikki Linnakangas [Sun, 23 Jan 2011 21:10:15 +0000 (23:10 +0200)]
Add 'directory' format to pg_dump. The new directory format is compatible
with the 'tar' format, in that untarring a tar format archive produces a
valid directory format archive.

Joachim Wieland and Heikki Linnakangas

13 years agoFix another portability issue in pg_basebackup.
Tom Lane [Sun, 23 Jan 2011 19:26:51 +0000 (14:26 -0500)]
Fix another portability issue in pg_basebackup.

The target of sscanf with a %o format had better be of integer width,
but "mode_t" conceivably isn't that.  Another compiler warning seen
only on some platforms; this one I think is potentially a real bug
and not just a warning.

13 years agoImprove getObjectDescription's display of pg_amop and pg_amproc entries.
Tom Lane [Sun, 23 Jan 2011 19:13:46 +0000 (14:13 -0500)]
Improve getObjectDescription's display of pg_amop and pg_amproc entries.

Include the lefttype/righttype columns explicitly (instead of assuming
the reader can deduce them from the operator or function description),
and move the operator or function description to the end of the string,
to make it clearer that it's a referenced object and not the amop or
amproc item itself.  Per extensive discussion of Andreas Karlsson's
original patch.

Andreas Karlsson, Tom Lane

13 years agoRevert "Factor out functions responsible for caching I/O routines".
Tom Lane [Sun, 23 Jan 2011 18:12:55 +0000 (13:12 -0500)]
Revert "Factor out functions responsible for caching I/O routines".

This reverts commit 740e54ca84c437fd67524f97a3ea9ddea752e208, which seems
to have tickled an optimization bug in gcc 4.5.x, as reported upstream at
https://bugzilla.redhat.com/show_bug.cgi?id=671899
Since this patch had no purpose beyond code beautification, it's not
worth expending a lot of effort to look for another workaround.

13 years agoAdd .gitignore file to silence complaints about pg_basebackup.
Tom Lane [Sun, 23 Jan 2011 18:07:34 +0000 (13:07 -0500)]
Add .gitignore file to silence complaints about pg_basebackup.

13 years agoSuppress uninitialized-variable warning.
Tom Lane [Sun, 23 Jan 2011 18:06:38 +0000 (13:06 -0500)]
Suppress uninitialized-variable warning.

13 years agoSilence flex warnings about DOS file paths in MSVC builds
Andrew Dunstan [Sun, 23 Jan 2011 17:24:15 +0000 (12:24 -0500)]
Silence flex warnings about DOS file paths in MSVC builds

13 years agoUse pg_strcasecmp instead of strcasecmp for portability
Magnus Hagander [Sun, 23 Jan 2011 16:35:02 +0000 (17:35 +0100)]
Use pg_strcasecmp instead of strcasecmp for portability

Per buildfarm.

13 years agoOnly show pg_stat_replication details to superusers
Magnus Hagander [Sun, 23 Jan 2011 16:28:19 +0000 (17:28 +0100)]
Only show pg_stat_replication details to superusers

13 years agofilemode is parsed on win32 even if never used
Magnus Hagander [Sun, 23 Jan 2011 13:45:23 +0000 (14:45 +0100)]
filemode is parsed on win32 even if never used

Per buildfarm failure.

13 years agoAdd pg_basebackup tool for streaming base backups
Magnus Hagander [Sun, 23 Jan 2011 11:21:23 +0000 (12:21 +0100)]
Add pg_basebackup tool for streaming base backups

This tool makes it possible to do the pg_start_backup/
copy files/pg_stop_backup step in a single command.

There are still some steps to be done before this is a
complete backup solution, such as the ability to stream
the required WAL logs, but it's still usable, and
could do with some buildfarm coverage.

In passing, make the checkpoint request optionally
fast instead of hardcoding it.

Magnus Hagander, reviewed by Fujii Masao and Dimitri Fontaine

13 years agoCode cleanup for assign_transaction_read_only.
Robert Haas [Sun, 23 Jan 2011 01:51:32 +0000 (20:51 -0500)]
Code cleanup for assign_transaction_read_only.

As in commit fb4c5d2798730f60b102d775f22fb53c26a6445d on 2011-01-21,
this avoids spurious debug messages and allows idempotent changes at
any time.  Along the way, make assign_XactIsoLevel allow idempotent
changes even when not within a subtransaction, to be consistent with
the new coding of assign_transaction_read_only and because there's
no compelling reason to do otherwise.

Kevin Grittner, with some adjustments.

13 years agoQuick hack to un-break plpython regression tests.
Tom Lane [Sun, 23 Jan 2011 01:43:54 +0000 (20:43 -0500)]
Quick hack to un-break plpython regression tests.

It's not clear to me what should happen to the other plpython_unicode
variant expected files, but this patch gets things passing on my own
machines and at least some of the buildfarm.

13 years agoAllow the wal_buffers setting to be auto-tuned to a reasonable value.
Tom Lane [Sun, 23 Jan 2011 01:31:24 +0000 (20:31 -0500)]
Allow the wal_buffers setting to be auto-tuned to a reasonable value.

If wal_buffers is initially set to -1 (which is now the default), it's
replaced by 1/32nd of shared_buffers, with a minimum of 8 (the old default)
and a maximum of the XLOG segment size.  The allowed range for manual
settings is still from 4 up to whatever will fit in shared memory.

Greg Smith, with implementation correction by me.

13 years agoSuppress "control reaches end of non-void function" warning from gcc 4.5.
Tom Lane [Sat, 22 Jan 2011 23:01:31 +0000 (18:01 -0500)]
Suppress "control reaches end of non-void function" warning from gcc 4.5.

Not sure why I'm seeing this on Fedora 14 and not earlier versions.
Seems like a regression that gcc no longer knows that DIE() doesn't return.
Still, adding a dummy return is harmless enough.

13 years agoSuppress possibly-uninitialized-variable warnings from gcc 4.5.
Tom Lane [Sat, 22 Jan 2011 22:56:42 +0000 (17:56 -0500)]
Suppress possibly-uninitialized-variable warnings from gcc 4.5.

It appears that gcc 4.5 can issue such warnings for whole structs, not
just scalar variables as in the past.  Refactor some pg_dump code slightly
so that the OutputContext local variables are always initialized, even
if they won't be used.  It's cheap enough to not be worth worrying about.

13 years agoGet rid of the global variable holding the error state
Peter Eisentraut [Sat, 22 Jan 2011 20:08:51 +0000 (22:08 +0200)]
Get rid of the global variable holding the error state

Global error handling led to confusion and was hard to manage.  With
this change, errors from PostgreSQL are immediately reported to Python
as exceptions.  This requires setting a Python exception after
reporting the caught PostgreSQL error as a warning, because PLy_elog
destroys the Python exception state.

Ideally, all places where PostgreSQL errors need to be reported back
to Python should be wrapped in subtransactions, to make going back to
Python from a longjmp safe.  This will be handled in a separate patch.

Jan Urbański

13 years agoMore pg_test_fsync fixups.
Tom Lane [Sat, 22 Jan 2011 20:01:26 +0000 (15:01 -0500)]
More pg_test_fsync fixups.

Reduce #includes to minimum actually needed; in particular include
postgres_fe.h not postgres.h, so as to stop build failures on some
platforms.

Use get_progname() instead of hardwired program name; improve error
checking for command line syntax; bring error messages into line with
style guidelines; include strerror result in die() cases.

13 years agoSuppress unused-variables warning when OPEN_SYNC_FLAG isn't defined.
Tom Lane [Sat, 22 Jan 2011 17:25:48 +0000 (12:25 -0500)]
Suppress unused-variables warning when OPEN_SYNC_FLAG isn't defined.

Per buildfarm.

13 years agoLink libpgport into pg_test_fsync on msvc
Magnus Hagander [Sat, 22 Jan 2011 17:16:20 +0000 (18:16 +0100)]
Link libpgport into pg_test_fsync on msvc

13 years agoAvoid treating WAL senders as normal backends.
Robert Haas [Sat, 22 Jan 2011 03:20:06 +0000 (22:20 -0500)]
Avoid treating WAL senders as normal backends.

The previous coding treated anything that wasn't an autovacuum launcher
as a normal backend, which is wrong now that we also have WAL senders.

Fujii Masao, reviewed by Robert Haas, Alvaro Herrera, Tom Lane,
and Bernd Helmle.

13 years agoCode cleanup for assign_XactIsoLevel.
Robert Haas [Sat, 22 Jan 2011 02:49:19 +0000 (21:49 -0500)]
Code cleanup for assign_XactIsoLevel.

The new coding avoids a spurious debug message when a transaction
that has changed the isolation level has been rolled back.  It also
allows the property to be freely changed to the current value within
a subtransaction.

Kevin Grittner, with one small change by me.

13 years agoMore pg_test_fsync cleanup.
Tom Lane [Sat, 22 Jan 2011 00:44:53 +0000 (19:44 -0500)]
More pg_test_fsync cleanup.

Un-break Windows build (I hope) by making the HAVE_FSYNC_WRITETHROUGH
code match the backend.  Fix incorrect program help message.  static-ize
all functions.

13 years agoClean up pg_test_fsync commit.
Tom Lane [Sat, 22 Jan 2011 00:27:25 +0000 (19:27 -0500)]
Clean up pg_test_fsync commit.

Actually rename the program, rather than just claiming we did.  Hook it
into the build system.  Get rid of useless dependency on libpq.  Clean up
#include list and messy whitespace.

13 years agoFix broken markup, also minor copy-editing.
Tom Lane [Fri, 21 Jan 2011 23:42:46 +0000 (18:42 -0500)]
Fix broken markup, also minor copy-editing.

13 years agoCorrectly add exceptions to the plpy module for Python 3
Peter Eisentraut [Fri, 21 Jan 2011 21:46:56 +0000 (23:46 +0200)]
Correctly add exceptions to the plpy module for Python 3

The way the exception types where added to the module was wrong for
Python 3.  Exception classes were not actually available from plpy.
Fix that by factoring out code that is responsible for defining new
Python exceptions and make it work with Python 3.  New regression test
makes sure the plpy module has the expected contents.

Jan Urbanśki, slightly revised by me

13 years agoEmphasize where OVER needs to be when using a window function.
Robert Haas [Fri, 21 Jan 2011 17:57:49 +0000 (12:57 -0500)]
Emphasize where OVER needs to be when using a window function.

Jeff Turner

13 years agoUpdate SGML docs to point to new /contrib/pg_test_fsync.
Bruce Momjian [Fri, 21 Jan 2011 17:52:16 +0000 (12:52 -0500)]
Update SGML docs to point to new /contrib/pg_test_fsync.

13 years agoUpdate C banner on new pg_test_fsync file.
Bruce Momjian [Fri, 21 Jan 2011 17:49:04 +0000 (12:49 -0500)]
Update C banner on new pg_test_fsync file.

13 years agoMove test_fsync to /contrib.
Bruce Momjian [Fri, 21 Jan 2011 17:47:54 +0000 (12:47 -0500)]
Move test_fsync to /contrib.

13 years agoDon't require usage privileges on the foreign data wrapper when creating a
Heikki Linnakangas [Fri, 21 Jan 2011 13:04:05 +0000 (15:04 +0200)]
Don't require usage privileges on the foreign data wrapper when creating a
foreign table. We check for usage privileges on the foreign server, that ought
to be enough.

Shigeru HANADA

13 years agoMake ALTER TABLE revalidate uniqueness and exclusion constraints.
Robert Haas [Fri, 21 Jan 2011 03:44:10 +0000 (22:44 -0500)]
Make ALTER TABLE revalidate uniqueness and exclusion constraints.

Failure to do so can lead to constraint violations.  This was broken by
commit 1ddc2703a936d03953657f43345460b9242bbed1 on 2010-02-07, so
back-patch to 9.0.

Noah Misch.  Regression test by me.

13 years agoFix wrong comment
Peter Eisentraut [Thu, 20 Jan 2011 20:04:36 +0000 (22:04 +0200)]
Fix wrong comment

Hitoshi Harada

13 years agoFix typo
Peter Eisentraut [Thu, 20 Jan 2011 20:01:10 +0000 (22:01 +0200)]
Fix typo

Hitoshi Harada

13 years agoFactor out functions responsible for caching I/O routines
Peter Eisentraut [Thu, 20 Jan 2011 19:23:27 +0000 (21:23 +0200)]
Factor out functions responsible for caching I/O routines

This makes PLy_procedure_create a bit more manageable.

Jan Urbański

13 years agoAdd new psql command \dL to list languages.
Robert Haas [Thu, 20 Jan 2011 05:00:30 +0000 (00:00 -0500)]
Add new psql command \dL to list languages.

Original patch by Fernando Ike, revived by Josh Kuperschmidt, reviewed by Andreas
Karlsson, and in earlier versions by Tom Lane and Peter Eisentraut.

13 years agoDocument that WITH queries are also called Common Table Expressions.
Robert Haas [Thu, 20 Jan 2011 02:15:45 +0000 (21:15 -0500)]
Document that WITH queries are also called Common Table Expressions.

Peter Geoghegan, reviewed by Stephen Frost

13 years agoShow correct datatype for pg_class.relpersistence, plus a typo fix.
Tom Lane [Wed, 19 Jan 2011 21:09:08 +0000 (16:09 -0500)]
Show correct datatype for pg_class.relpersistence, plus a typo fix.

Thom Brown

13 years agoAdd braces around an if block, for readability
Peter Eisentraut [Wed, 19 Jan 2011 19:56:21 +0000 (21:56 +0200)]
Add braces around an if block, for readability

Jan Urbański, reviewed by Peter Eisentraut, Álvaro Herrera, Tom Lane :-)

13 years agoFree plan values in the PLyPlanObject dealloc function
Peter Eisentraut [Tue, 18 Jan 2011 22:10:19 +0000 (00:10 +0200)]
Free plan values in the PLyPlanObject dealloc function

Jan Urbański

13 years agoImprove message for errors in compiling anonymous PL/Python blocks
Peter Eisentraut [Tue, 18 Jan 2011 22:03:57 +0000 (00:03 +0200)]
Improve message for errors in compiling anonymous PL/Python blocks

The previous code would try to print out a null pointer.

Jan Urbański

13 years agoUse PyObject_New instead of PyObject_NEW
Peter Eisentraut [Tue, 18 Jan 2011 21:53:10 +0000 (23:53 +0200)]
Use PyObject_New instead of PyObject_NEW

The latter is undocumented and the speed gain is negligible.

Jan Urbański

13 years agoSkip dropped attributes when converting Python objects to tuples
Peter Eisentraut [Tue, 18 Jan 2011 21:39:09 +0000 (23:39 +0200)]
Skip dropped attributes when converting Python objects to tuples

Pay attention to the attisdropped field and skip over TupleDesc fields
that have it set.  Not a real problem until we get table returning
functions, but it's the right thing to do anyway.

Jan Urbański

13 years agoUse palloc in TopMemoryContext instead of malloc
Peter Eisentraut [Tue, 18 Jan 2011 21:27:53 +0000 (23:27 +0200)]
Use palloc in TopMemoryContext instead of malloc

As discussed, even if the PL needs a permanent memory location, it
should use palloc, not malloc.  It also makes error handling easier.

Jan Urbański

13 years agoFix an error when a set-returning function fails halfway through the execution
Peter Eisentraut [Tue, 18 Jan 2011 21:22:37 +0000 (23:22 +0200)]
Fix an error when a set-returning function fails halfway through the execution

If the function using yield to return rows fails halfway, the iterator
stays open and subsequent calls to the function will resume reading
from it.  The fix is to unref the iterator and set it to NULL if there
has been an error.

Jan Urbański

13 years agoIn test_fsync, adjust test headings to match wal_sync_method values;
Bruce Momjian [Tue, 18 Jan 2011 20:53:20 +0000 (15:53 -0500)]
In test_fsync, adjust test headings to match wal_sync_method values;
add more test cases for open_sync of different sizes.

13 years agoAvoid detoast in texteq/textne/byteaeq/byteane for unequal-length strings.
Tom Lane [Tue, 18 Jan 2011 19:09:22 +0000 (14:09 -0500)]
Avoid detoast in texteq/textne/byteaeq/byteane for unequal-length strings.

We can get the length of a compressed or out-of-line datum without actually
detoasting it.  If the lengths of two strings are unequal, we can then
conclude they are unequal without detoasting.  That saves considerable work
in an admittedly less-common case, without costing anything much when the
optimization doesn't apply.

Noah Misch

13 years agoLog replication connections only when log_connections is on
Magnus Hagander [Tue, 18 Jan 2011 19:02:25 +0000 (20:02 +0100)]
Log replication connections only when log_connections is on

Previously we'd always log replication connections, with no
way to turn them off.

13 years agoFix thinko in comment. Spotted by Jim Nasby.
Heikki Linnakangas [Tue, 18 Jan 2011 08:38:15 +0000 (10:38 +0200)]
Fix thinko in comment. Spotted by Jim Nasby.

13 years agoRemove "github test" that somehow got into my tree. Sorry.
Bruce Momjian [Tue, 18 Jan 2011 02:40:42 +0000 (21:40 -0500)]
Remove "github test" that somehow got into my tree.  Sorry.

13 years agoIn the docs, better distinguish server from client SSL settings in the documentation.
Bruce Momjian [Tue, 18 Jan 2011 02:30:28 +0000 (21:30 -0500)]
In the docs, better distinguish server from client SSL settings in the documentation.

Ray Stell

Also fix some libpq title capitalization problems.

13 years agogithub test
Bruce Momjian [Tue, 18 Jan 2011 01:14:07 +0000 (20:14 -0500)]
github test

13 years agoUse HTABs instead of Python dictionary objects to cache procedures
Peter Eisentraut [Mon, 17 Jan 2011 19:46:36 +0000 (21:46 +0200)]
Use HTABs instead of Python dictionary objects to cache procedures

Two separate hash tables are used for regular procedures and for
trigger procedures, since the way trigger procedures work is quite
different from normal stored procedures.  Change the signatures of
PLy_procedure_{get,create} to accept the function OID and a Boolean
flag indicating whether it's a trigger.  This should make implementing
a PL/Python validator easier.

Using HTABs instead of Python dictionaries makes error recovery
easier, and allows for procedures to be cached based on their OIDs,
not their names.  It also allows getting rid of the PyCObject field
that used to hold a pointer to PLyProcedure, since PyCObjects are
deprecated in Python 2.7 and replaced by Capsules in Python 3.

Jan Urbański

13 years agoFix miscalculation of itemsafter in array_set_slice().
Tom Lane [Mon, 17 Jan 2011 17:38:52 +0000 (12:38 -0500)]
Fix miscalculation of itemsafter in array_set_slice().

If the slice to be assigned to was before the existing array lower bound
(requiring at least one null element to spring into existence to fill the
gap), the code miscalculated how many entries needed to be copied from
the old array's null bitmap.  This could result in trashing the array's
data area (as seen in bug #5840 from Karsten Loesing), or worse.

This has been broken since we first allowed the behavior of assigning to
non-adjacent slices, in 8.2.  Back-patch to all affected versions.

13 years agoIncrement Py_None refcount for NULL array elements
Alvaro Herrera [Mon, 17 Jan 2011 15:59:41 +0000 (12:59 -0300)]
Increment Py_None refcount for NULL array elements

Per bug #5835 by Julien Demoor
Author: Alex Hunsaker

13 years agoAdd getopt() support to test_fsync; also fix printf() format problem.
Bruce Momjian [Mon, 17 Jan 2011 14:35:51 +0000 (09:35 -0500)]
Add getopt() support to test_fsync;  also fix printf() format problem.

13 years agoSet fallback_application_name in walreceiver
Magnus Hagander [Mon, 17 Jan 2011 10:42:12 +0000 (11:42 +0100)]
Set fallback_application_name in walreceiver

Makes replication slaves identify themselves in the new
pg_stat_replication view.

13 years agoBefore exiting walreceiver, fsync() all the WAL received.
Heikki Linnakangas [Mon, 17 Jan 2011 10:22:24 +0000 (12:22 +0200)]
Before exiting walreceiver, fsync() all the WAL received.

Otherwise WAL recovery will replay the un-flushed WAL after walreceiver has
exited, which can lead to a non-recoverable standby if the system crashes hard
at that point.

13 years agoIn test_fsync, use #define for printf format of ops/sec.
Bruce Momjian [Sun, 16 Jan 2011 13:36:43 +0000 (08:36 -0500)]
In test_fsync, use #define for printf format of ops/sec.

13 years agoUse O_DIRECT in O_SYNC test of different size. Restructure O_DIRECT
Bruce Momjian [Sun, 16 Jan 2011 00:40:49 +0000 (19:40 -0500)]
Use O_DIRECT in O_SYNC test of different size.  Restructure O_DIRECT
error reporting to be more consistent.

13 years agoReverse number of stars used for test_fsync details.
Bruce Momjian [Sat, 15 Jan 2011 23:40:10 +0000 (18:40 -0500)]
Reverse number of stars used for test_fsync details.

13 years agoIn test_fsync, warn about options without o_direct that are not used by
Bruce Momjian [Sat, 15 Jan 2011 23:27:10 +0000 (18:27 -0500)]
In test_fsync, warn about options without o_direct that are not used by
Postgres, and cases where o_direct does not work with certain file systems.

13 years agoMove a couple of declarations to reflect where the routines really are.
Tom Lane [Sat, 15 Jan 2011 21:09:05 +0000 (16:09 -0500)]
Move a couple of declarations to reflect where the routines really are.

13 years agoAdd .gitignore to silence git complaints about parser/scanner output files.
Tom Lane [Sat, 15 Jan 2011 21:05:28 +0000 (16:05 -0500)]
Add .gitignore to silence git complaints about parser/scanner output files.

13 years agoHave test_fsync output details that fdatasync is the default
Bruce Momjian [Sat, 15 Jan 2011 20:00:20 +0000 (15:00 -0500)]
Have test_fsync output details that fdatasync is the default
wal_sync_method on Linux.

13 years agoRestructure test_fync to use modular C so there is less duplicate code
Bruce Momjian [Sat, 15 Jan 2011 19:42:12 +0000 (14:42 -0500)]
Restructure test_fync to use modular C so there is less duplicate code
and it can be enhanced easier.

13 years agoEnumerate available tablespaces after starting the backup
Magnus Hagander [Sat, 15 Jan 2011 18:18:14 +0000 (19:18 +0100)]
Enumerate available tablespaces after starting the backup

This closes a race condition where if a tablespace was created
after the enumeration happened but before the do_pg_start_backup()
was called, the backup would be incomplete. Now that it's done
while we are in backup mode, WAL replay will recreate it during
restore.

Noted by Heikki.

13 years agoImprove output display of test_fsync.
Bruce Momjian [Sat, 15 Jan 2011 17:24:05 +0000 (12:24 -0500)]
Improve output display of test_fsync.

13 years agoApply patch for test_fsync to add tests for O_DIRECT.
Bruce Momjian [Sat, 15 Jan 2011 16:54:43 +0000 (11:54 -0500)]
Apply patch for test_fsync to add tests for O_DIRECT.

Adjusted patch by Josh Berkus

13 years agoTreat a WAL sender process that hasn't started streaming yet as a regular
Heikki Linnakangas [Sat, 15 Jan 2011 14:27:40 +0000 (16:27 +0200)]
Treat a WAL sender process that hasn't started streaming yet as a regular
backend, as far as the postmaster shutdown logic is concerned. That means,
fast shutdown will wait for WAL sender processes to exit before signaling
bgwriter to finish. This avoids race conditions between a base backup stopping
or starting, and bgwriter writing the shutdown checkpoint WAL record. We don't
want e.g the end-of-backup WAL record to be written after the shutdown
checkpoint.

13 years agoUse a lexer and grammar for parsing walsender commands
Magnus Hagander [Fri, 14 Jan 2011 15:30:33 +0000 (16:30 +0100)]
Use a lexer and grammar for parsing walsender commands

Makes it easier to parse mainly the BASE_BACKUP command
with it's options, and avoids having to manually deal
with quoted identifiers in the label (previously broken),
and makes it easier to add new commands and options in
the future.

In passing, refactor the case statement in the walsender
to put each command in it's own function.

13 years agoExit from base backups when shutdown is requested
Magnus Hagander [Fri, 14 Jan 2011 11:36:45 +0000 (12:36 +0100)]
Exit from base backups when shutdown is requested

When the exit waits until the whole backup completes, it may take
a very long time.

In passing, add back an error check in the main loop so we detect
clients that disconnect much earlier if the backup is large.

13 years agoCode review for postmaster.pid contents changes.
Tom Lane [Fri, 14 Jan 2011 00:01:28 +0000 (19:01 -0500)]
Code review for postmaster.pid contents changes.

Fix broken test for pre-existing postmaster, caused by wrong code for
appending lines to the lockfile; don't write a failed listen_address
setting into the lockfile; don't arbitrarily change the location of the
data directory in the lockfile compared to previous releases; provide more
consistent and useful definitions of the socket path and listen_address
entries; avoid assuming that pg_ctl has the same DEFAULT_PGSOCKET_DIR as
the postmaster; assorted code style improvements.

13 years agoRevert incorrect memory-conservation hack in inheritance_planner().
Tom Lane [Thu, 13 Jan 2011 19:33:19 +0000 (14:33 -0500)]
Revert incorrect memory-conservation hack in inheritance_planner().

This reverts commit d1001a78ce612a16ea622b558f5fc2b68c45ab4c of 2010-12-05,
which was broken as reported by Jeff Davis.  The problem is that the
individual planning steps may have side-effects on substructures of
PlannerGlobal, not only the current PlannerInfo root.  Arranging to keep
all such side effects in the main planning context is probably possible,
but it would change this from a quick local hack into a wide-ranging and
rather fragile endeavor.  Which it's not worth.

13 years agoMake sure walsender state is only read while holding the spinlock
Magnus Hagander [Thu, 13 Jan 2011 17:51:13 +0000 (18:51 +0100)]
Make sure walsender state is only read while holding the spinlock

Noted by Robert Haas.

13 years agoMore libpq documentation adjustments from Leslie S Satenstein, reviewed
Bruce Momjian [Thu, 13 Jan 2011 17:07:51 +0000 (12:07 -0500)]
More libpq documentation adjustments from Leslie S Satenstein, reviewed
by Robert Haas.

13 years agoFix the logic in libpqrcv_receive() to determine if there's any incoming data
Heikki Linnakangas [Thu, 13 Jan 2011 15:51:28 +0000 (17:51 +0200)]
Fix the logic in libpqrcv_receive() to determine if there's any incoming data
that can be read without blocking. It used to conclude that there isn't, even
though there was data in the socket receive buffer. That lead walreceiver to
flush the WAL after every received chunk, potentially causing big performance
issues.

Backpatch to 9.0, because the performance impact can be very significant.

13 years agoWorkaround for recursive make breakage
Peter Eisentraut [Thu, 13 Jan 2011 07:32:06 +0000 (09:32 +0200)]
Workaround for recursive make breakage

Changing a file two directory levels deep under src/backend/ would not
cause the postgres binary to be rebuilt.  This change fixes it, but no
one knows why.

13 years agoDon't run regression tests in SQL_ASCII encoding by default
Peter Eisentraut [Thu, 13 Jan 2011 07:13:12 +0000 (09:13 +0200)]
Don't run regression tests in SQL_ASCII encoding by default

Instead, run them in the encoding that the locale selects, which is
more representative of real use.

Also document how locale and encoding for regression test runs can be
selected.

13 years agoApply libpq documentation patches submitted by Leslie S Satenstein and
Bruce Momjian [Thu, 13 Jan 2011 01:49:49 +0000 (20:49 -0500)]
Apply libpq documentation patches submitted by Leslie S Satenstein and
reviewed by Robert Haas.

13 years agoFix PlanRowMark/ExecRowMark structures to handle inheritance correctly.
Tom Lane [Thu, 13 Jan 2011 01:47:02 +0000 (20:47 -0500)]
Fix PlanRowMark/ExecRowMark structures to handle inheritance correctly.

In an inherited UPDATE/DELETE, each target table has its own subplan,
because it might have a column set different from other targets.  This
means that the resjunk columns we add to support EvalPlanQual might be
at different physical column numbers in each subplan.  The EvalPlanQual
rewrite I did for 9.0 failed to account for this, resulting in possible
misbehavior or even crashes during concurrent updates to the same row,
as seen in a recent report from Gordon Shannon.  Revise the data structure
so that we track resjunk column numbers separately for each subplan.

I also chose to move responsibility for identifying the physical column
numbers back to executor startup, instead of assuming that numbers derived
during preprocess_targetlist would stay valid throughout subsequent
massaging of the plan.  That's a bit slower, so we might want to consider
undoing it someday; but it would complicate the patch considerably and
didn't seem justifiable in a bug fix that has to be back-patched to 9.0.

13 years agoRevert patch adding support for logging the current role.
Robert Haas [Wed, 12 Jan 2011 16:59:21 +0000 (11:59 -0500)]
Revert patch adding support for logging the current role.

This reverts commit a8a8867912c46a68c9ac14903b3dba2fab8f7097, committed
by me earlier today (2011-01-12).  This isn't safe inside an aborted
transaction.

Noted by Tom Lane.

13 years agoAdd support for logging the current role.
Robert Haas [Wed, 12 Jan 2011 16:34:53 +0000 (11:34 -0500)]
Add support for logging the current role.

Stephen Frost, with some editorialization by me.

13 years agoUnbreak regression tests, apparently broken by commit 4c8e20f
Andrew Dunstan [Wed, 12 Jan 2011 03:27:20 +0000 (22:27 -0500)]
Unbreak regression tests, apparently broken by commit 4c8e20f

13 years agoRe-add recursive coverage target in src/backend/
Peter Eisentraut [Tue, 11 Jan 2011 22:26:20 +0000 (00:26 +0200)]
Re-add recursive coverage target in src/backend/

This was lost during the recent recursive make change.

13 years agoAdd some subsection headings
Peter Eisentraut [Tue, 11 Jan 2011 20:47:58 +0000 (22:47 +0200)]
Add some subsection headings

13 years agoTrack walsender state in shared memory and expose in pg_stat_replication
Magnus Hagander [Tue, 11 Jan 2011 20:25:28 +0000 (21:25 +0100)]
Track walsender state in shared memory and expose in pg_stat_replication

13 years agoAdd missing function prototype, for consistency
Magnus Hagander [Tue, 11 Jan 2011 20:12:12 +0000 (21:12 +0100)]
Add missing function prototype, for consistency

13 years agoAdjust basebackup.c to suppress compiler warnings.
Tom Lane [Tue, 11 Jan 2011 18:41:13 +0000 (13:41 -0500)]
Adjust basebackup.c to suppress compiler warnings.

Some versions of gcc complain about "variable `tablespaces' might be
clobbered by `longjmp' or `vfork'" with the original coding.  Fix by
moving the PG_TRY block into a separate subroutine.

13 years agoTweak create_index_paths()'s test for whether to consider a bitmap scan.
Tom Lane [Tue, 11 Jan 2011 17:12:04 +0000 (12:12 -0500)]
Tweak create_index_paths()'s test for whether to consider a bitmap scan.

Per my note of a couple days ago, create_index_paths would refuse to
consider any path at all for GIN indexes if the selectivity estimate came
out as 1.0; not even if you tried to force it with enable_seqscan.  While
this isn't really a bad outcome in practice, it could be annoying for
testing purposes.  Adjust the test for "is this path only useful for
sorting" so that it doesn't fire on paths with nil pathkeys, which will
include all GIN paths.

13 years agoTypo fix
Magnus Hagander [Tue, 11 Jan 2011 09:45:16 +0000 (10:45 +0100)]
Typo fix

Josh Kupershmidt

13 years agoReset walsender ps title in the main loop
Magnus Hagander [Tue, 11 Jan 2011 09:04:54 +0000 (10:04 +0100)]
Reset walsender ps title in the main loop

When in streaming mode we can never get out, so it will never
be required, but after a base backup (or other operations)
we can get back to the loop, so the title needs to be cleared.

13 years agoSet process title to indicate base backup is running
Magnus Hagander [Mon, 10 Jan 2011 20:50:10 +0000 (21:50 +0100)]
Set process title to indicate base backup is running