1. 01 4月, 2010 1 次提交
    • R
      Refer to max_wal_senders in a more consistent fashion. · 54943734
      Robert Haas 提交于
      The error message now makes explicit reference to the GUC that must be changed
      to fix the problem, using wording suggested by Tom Lane.  Along the way,
      rename the GUC from MaxWalSenders to max_wal_senders for consistency and
      grep-ability.
      54943734
  2. 25 3月, 2010 1 次提交
  3. 21 3月, 2010 1 次提交
  4. 26 2月, 2010 1 次提交
  5. 25 2月, 2010 1 次提交
  6. 17 2月, 2010 2 次提交
  7. 13 2月, 2010 1 次提交
    • S
      Re-enable max_standby_delay = -1 using deadlock detection on startup · b95a720a
      Simon Riggs 提交于
      process. If startup waits on a buffer pin we send a request to all
      backends to cancel themselves if they are holding the buffer pin
      required and they are also waiting on a lock. If not, startup waits
      until max_standby_delay before cancelling any backend waiting for
      the requested buffer pin.
      b95a720a
  8. 01 2月, 2010 1 次提交
  9. 30 1月, 2010 1 次提交
    • S
      Augment WAL records for btree delete with GetOldestXmin() to reduce · 6d2bc0a6
      Simon Riggs 提交于
      false positives during Hot Standby conflict processing. Simple
      patch to enhance conflict processing, following previous discussions.
      Controlled by parameter minimize_standby_conflicts = on | off, with
      default off allows measurement of performance impact to see whether
      it should be set on all the time.
      6d2bc0a6
  10. 27 1月, 2010 1 次提交
    • T
      Remove the default_do_language parameter, instead making DO use a hardwired · d879697c
      Tom Lane 提交于
      default of "plpgsql".  This is more reasonable than it was when the DO patch
      was written, because we have since decided that plpgsql should be installed
      by default.  Per discussion, having a parameter for this doesn't seem useful
      enough to justify the risk of application breakage if the value is changed
      unexpectedly.
      d879697c
  11. 25 1月, 2010 1 次提交
    • T
      Fix assorted core dumps and Assert failures that could occur during · 875353b9
      Tom Lane 提交于
      AbortTransaction or AbortSubTransaction, when trying to clean up after an
      error that prevented (sub)transaction start from completing:
      * access to TopTransactionResourceOwner that might not exist
      * assert failure in AtEOXact_GUC, if AtStart_GUC not called yet
      * assert failure or core dump in AfterTriggerEndSubXact, if
        AfterTriggerBeginSubXact not called yet
      
      Per testing by injecting elog(ERROR) at successive steps in StartTransaction
      and StartSubTransaction.  It's not clear whether all of these cases could
      really occur in the field, but at least one of them is easily exposed by
      simple stress testing, as per my accidental discovery yesterday.
      875353b9
  12. 24 1月, 2010 1 次提交
    • S
      In HS, Startup process sets SIGALRM when waiting for buffer pin. If · 959ac58c
      Simon Riggs 提交于
      woken by alarm we send SIGUSR1 to all backends requesting that they
      check to see if they are blocking Startup process. If so, they throw
      ERROR/FATAL as for other conflict resolutions. Deadlock stop gap
      removed. max_standby_delay = -1 option removed to prevent deadlock.
      959ac58c
  13. 15 1月, 2010 1 次提交
    • H
      Introduce Streaming Replication. · 40f908bd
      Heikki Linnakangas 提交于
      This includes two new kinds of postmaster processes, walsenders and
      walreceiver. Walreceiver is responsible for connecting to the primary server
      and streaming WAL to disk, while walsender runs in the primary server and
      streams WAL from disk to the client.
      
      Documentation still needs work, but the basics are there. We will probably
      pull the replication section to a new chapter later on, as well as the
      sections describing file-based replication. But let's do that as a separate
      patch, so that it's easier to see what has been added/changed. This patch
      also adds a new section to the chapter about FE/BE protocol, documenting the
      protocol used by walsender/walreceivxer.
      
      Bump catalog version because of two new functions,
      pg_last_xlog_receive_location() and pg_last_xlog_replay_location(), for
      monitoring the progress of replication.
      
      Fujii Masao, with additional hacking by me
      40f908bd
  14. 07 1月, 2010 1 次提交
  15. 03 1月, 2010 1 次提交
  16. 01 1月, 2010 1 次提交
  17. 21 12月, 2009 1 次提交
  18. 19 12月, 2009 1 次提交
    • S
      Allow read only connections during recovery, known as Hot Standby. · efc16ea5
      Simon Riggs 提交于
      Enabled by recovery_connections = on (default) and forcing archive recovery using a recovery.conf. Recovery processing now emulates the original transactions as they are replayed, providing full locking and MVCC behaviour for read only queries. Recovery must enter consistent state before connections are allowed, so there is a delay, typically short, before connections succeed. Replay of recovering transactions can conflict and in some cases deadlock with queries during recovery; these result in query cancellation after max_standby_delay seconds have expired. Infrastructure changes have minor effects on normal running, though introduce four new types of WAL record.
      
      New test mode "make standbycheck" allows regression tests of static command behaviour on a standby server while in recovery. Typical and extreme dynamic behaviours have been checked via code inspection and manual testing. Few port specific behaviours have been utilised, though primary testing has been on Linux only so far.
      
      This commit is the basic patch. Additional changes will follow in this release to enhance some aspects of behaviour, notably improved handling of conflicts, deadlock detection and query cancellation. Changes to VACUUM FULL are also required.
      
      Simon Riggs, with significant and lengthy review by Heikki Linnakangas, including streamlined redesign of snapshot creation and two-phase commit.
      
      Important contributions from Florian Pflug, Mark Kirkwood, Merlin Moncure, Greg Stark, Gianni Ciolli, Gabriele Bartolini, Hannu Krosing, Robert Haas, Tatsuo Ishii, Hiroyuki Yamada plus support and feedback from many other community members.
      efc16ea5
  19. 11 12月, 2009 1 次提交
    • I
      Add large object access control. · f1325ce2
      Itagaki Takahiro 提交于
      A new system catalog pg_largeobject_metadata manages
      ownership and access privileges of large objects.
      
      KaiGai Kohei, reviewed by Jaime Casanova.
      f1325ce2
  20. 10 12月, 2009 1 次提交
    • T
      Prevent indirect security attacks via changing session-local state within · 62aba765
      Tom Lane 提交于
      an allegedly immutable index function.  It was previously recognized that
      we had to prevent such a function from executing SET/RESET ROLE/SESSION
      AUTHORIZATION, or it could trivially obtain the privileges of the session
      user.  However, since there is in general no privilege checking for changes
      of session-local state, it is also possible for such a function to change
      settings in a way that might subvert later operations in the same session.
      Examples include changing search_path to cause an unexpected function to
      be called, or replacing an existing prepared statement with another one
      that will execute a function of the attacker's choosing.
      
      The present patch secures VACUUM, ANALYZE, and CREATE INDEX/REINDEX against
      these threats, which are the same places previously deemed to need protection
      against the SET ROLE issue.  GUC changes are still allowed, since there are
      many useful cases for that, but we prevent security problems by forcing a
      rollback of any GUC change after completing the operation.  Other cases are
      handled by throwing an error if any change is attempted; these include temp
      table creation, closing a cursor, and creating or deleting a prepared
      statement.  (In 7.4, the infrastructure to roll back GUC changes doesn't
      exist, so we settle for rejecting changes of "search_path" in these contexts.)
      
      Original report and patch by Gurjeet Singh, additional analysis by
      Tom Lane.
      
      Security: CVE-2009-4136
      62aba765
  21. 02 12月, 2009 1 次提交
    • T
      Mark application_name as GUC_REPORT so that the value will be reported back · 59ed94ad
      Tom Lane 提交于
      to the client by the server.  This might seem pretty pointless but apparently
      it will help pgbouncer, and perhaps other connection poolers.  Anyway it's
      practically free to do so for the normal use-case where appname is only set
      in the startup packet --- we're just adding a few more bytes to the initial
      ParameterStatus response packet.  Per comments from Marko Kreen.
      59ed94ad
  22. 29 11月, 2009 1 次提交
  23. 22 10月, 2009 2 次提交
    • T
      Remove regex_flavor GUC, so that regular expressions are always "advanced" · ab61df9e
      Tom Lane 提交于
      style by default.  Per discussion, there seems to be hardly anything that
      really relies on being able to change the regex flavor, so the ability to
      select it via embedded options ought to be enough for any stragglers.
      Also, if we didn't remove the GUC, we'd really be morally obligated to
      mark the regex functions non-immutable, which'd possibly create performance
      issues.
      ab61df9e
    • T
      Remove add_missing_from GUC and associated parser support for "implicit RTEs". · 289e2905
      Tom Lane 提交于
      Per recent discussion, add_missing_from has been deprecated for long enough to
      consider removing, and it's getting in the way of planned parser refactoring.
      The system now always behaves as though add_missing_from were OFF.
      289e2905
  24. 13 10月, 2009 1 次提交
  25. 04 10月, 2009 1 次提交
    • T
      Fix a couple of issues in recent patch to print updates to postgresql.conf · 54d60bbd
      Tom Lane 提交于
      settings: avoid calling superuser() in contexts where it's not defined,
      don't leak the transient copies of GetConfigOption output, and avoid the
      whole exercise in postmaster child processes.
      
      I found that actually no current caller of GetConfigOption has any use for
      its internal check of GUC_SUPERUSER_ONLY.  But rather than just remove
      that entirely, it seemed better to add a parameter indicating whether to
      enforce the check.
      
      Per report from Simon and subsequent testing.
      54d60bbd
  26. 23 9月, 2009 1 次提交
    • T
      Implement the DO statement to support execution of PL code without having · 9048b731
      Tom Lane 提交于
      to create a function for it.
      
      Procedural languages now have an additional entry point, namely a function
      to execute an inline code block.  This seemed a better design than trying
      to hide the transient-ness of the code from the PL.  As of this patch, only
      plpgsql has an inline handler, but probably people will soon write handlers
      for the other standard PLs.
      
      In passing, remove the long-dead LANCOMPILER option of CREATE LANGUAGE.
      
      Petr Jelinek
      9048b731
  27. 18 9月, 2009 1 次提交
  28. 12 9月, 2009 1 次提交
  29. 09 9月, 2009 1 次提交
    • T
      Add a boolean GUC parameter "bonjour" to control whether a Bonjour-enabled · eeb6cb14
      Tom Lane 提交于
      build actually attempts to advertise itself via Bonjour.  Formerly it always
      did so, which meant that packagers had to decide for their users whether
      this behavior was wanted or not.  The default is "off" to be on the safe
      side, though this represents a change in the default behavior of a
      Bonjour-enabled build.  Per discussion.
      eeb6cb14
  30. 04 9月, 2009 1 次提交
    • T
      Disallow RESET ROLE and RESET SESSION AUTHORIZATION inside security-definer · 187e5d89
      Tom Lane 提交于
      functions.
      
      This extends the previous patch that forbade SETting these variables inside
      security-definer functions.  RESET is equally a security hole, since it
      would allow regaining privileges of the caller; furthermore it can trigger
      Assert failures and perhaps other internal errors, since the code is not
      expecting these variables to change in such contexts.  The previous patch
      did not cover this case because assign hooks don't really have enough
      information, so move the responsibility for preventing this into guc.c.
      
      Problem discovered by Heikki Linnakangas.
      
      Security: no CVE assigned yet, extends CVE-2007-6600
      187e5d89
  31. 01 9月, 2009 1 次提交
    • T
      Change the autovacuum launcher to read pg_database directly, rather than · 00e6a16d
      Tom Lane 提交于
      via the "flat files" facility.  This requires making it enough like a backend
      to be able to run transactions; it's no longer an "auxiliary process" but
      more like the autovacuum worker processes.  Also, its signal handling has
      to be brought into line with backends/workers.  In particular, since it
      now has to handle procsignal.c processing, the special autovac-launcher-only
      signal conditions are moved to SIGUSR2.
      
      Alvaro, with some cleanup from Tom
      00e6a16d
  32. 31 8月, 2009 1 次提交
    • T
      Track the current XID wrap limit (or more accurately, the oldest unfrozen · 25ec228e
      Tom Lane 提交于
      XID) in checkpoint records.  This eliminates the need to recompute the value
      from scratch during database startup, which is one of the two remaining
      reasons for the flatfile code to exist.  It should also simplify life for
      hot-standby operation.
      
      To avoid bloating the checkpoint records unreasonably, I switched from
      tracking the oldest database by name to tracking it by OID.  This turns
      out to save cycles in general (everywhere but the warning-generating
      paths, which we hardly care about) and also helps us deal with the case
      that the oldest database got dropped instead of being vacuumed.  The prior
      coding might go for a long time without updating the wrap limit in that case,
      which is bad because it might result in a lot of useless autovacuum activity.
      25ec228e
  33. 30 8月, 2009 1 次提交
    • T
      Remove the use of the pg_auth flat file for client authentication. · e710b65c
      Tom Lane 提交于
      (That flat file is now completely useless, but removal will come later.)
      
      To do this, postpone client authentication into the startup transaction
      that's run by InitPostgres.  We still collect the startup packet and do
      SSL initialization (if needed) at the same time we did before.  The
      AuthenticationTimeout is applied separately to startup packet collection
      and the actual authentication cycle.  (This is a bit annoying, since it
      means a couple extra syscalls; but the signal handling requirements inside
      and outside a transaction are sufficiently different that it seems best
      to treat the timeouts as completely independent.)
      
      A small security disadvantage is that if the given database name is invalid,
      this will be reported to the client before any authentication happens.
      We could work around that by connecting to database "postgres" instead,
      but consensus seems to be that it's not worth introducing such surprising
      behavior.
      
      Processing of all command-line switches and GUC options received from the
      client is now postponed until after authentication.  This means that
      PostAuthDelay is much less useful than it used to be --- if you need to
      investigate problems during InitPostgres you'll have to set PreAuthDelay
      instead.  However, allowing an unauthenticated user to set any GUC options
      whatever seems a bit too risky, so we'll live with that.
      e710b65c
  34. 25 8月, 2009 1 次提交
    • T
      Try to make silent_mode behave somewhat reasonably. · 8bed238c
      Tom Lane 提交于
      Instead of sending stdout/stderr to /dev/null after forking away from the
      terminal, send them to postmaster.log within the data directory.  Since
      this opens the door to indefinite logfile bloat, recommend even more
      strongly that log output be redirected when using silent_mode.
      
      Move the postmaster's initial calls of load_hba() and load_ident() down
      to after we have started the log collector, if we are going to.  This
      is so that errors reported by them will appear in the "usual" place.
      
      Reclassify silent_mode as a LOGGING_WHERE, not LOGGING_WHEN, parameter,
      since it's got absolutely nothing to do with the latter category.
      
      In passing, fix some obsolete references to -S ... this option hasn't
      had that switch letter for a long time.
      
      Back-patch to 8.4, since as of 8.4 load_hba() and load_ident() are more
      picky (and thus more likely to fail) than they used to be.  This entire
      change was driven by a complaint about those errors disappearing into
      the bit bucket.
      8bed238c
  35. 05 8月, 2009 1 次提交
    • T
      Support hex-string input and output for type BYTEA. · a2a8c7a6
      Tom Lane 提交于
      Both hex format and the traditional "escape" format are automatically
      handled on input.  The output format is selected by the new GUC variable
      bytea_output.
      
      As committed, bytea_output defaults to HEX, which is an *incompatible
      change*.  We will keep it this way for awhile for testing purposes, but
      should consider whether to switch to the more backwards-compatible
      default of ESCAPE before 8.5 is released.
      
      Peter Eisentraut
      a2a8c7a6
  36. 23 7月, 2009 1 次提交
  37. 17 7月, 2009 1 次提交
    • T
      Make GEQO's planning deterministic by having it start from a predictable · f5bc7419
      Tom Lane 提交于
      random number seed each time.  This is how it used to work years ago, but
      we got rid of the seed reset because it was resetting the main random()
      sequence and thus having undesirable effects on the rest of the system.
      To fix, establish a private random number state for each execution of
      geqo(), and initialize the state using the new GUC variable geqo_seed.
      People who want to experiment with different random searches can do so
      by changing geqo_seed, but you'll always get the same plan for the same
      value of geqo_seed (if holding all other planner inputs constant, of course).
      
      The new state is kept in PlannerInfo by adding a "void *" field reserved
      for use by join_search hooks.  Most of the rather bulky code changes in
      this commit are just arranging to pass PlannerInfo around to all the GEQO
      functions (many of which formerly didn't receive it).
      
      Andres Freund, with some editorialization by Tom
      f5bc7419
  38. 16 7月, 2009 1 次提交
    • P
      Make backend header files C++ safe · de160e2c
      Peter Eisentraut 提交于
      This alters various incidental uses of C++ key words to use other similar
      identifiers, so that a C++ compiler won't choke outright.  You still
      (probably) need extern "C" { }; around the inclusion of backend headers.
      
      based on a patch by Kurt Harriman <harriman@acm.org>
      
      Also add a script cpluspluscheck to check for C++ compatibility in the
      future.  As of right now, this passes without error for me.
      de160e2c