1. 04 Jul, 2012 9 commits
  2. 03 Jul, 2012 4 commits
  3. 02 Jul, 2012 7 commits
    • Robert Haas's avatar
      Fix a stupid bug I introduced into XLogFlush(). · 3cf39e6d
      Robert Haas authored
      Commit f11e8be3 broke this; it was right
      in Peter's original patch, but I messed it up before committing.
      3cf39e6d
    • Robert Haas's avatar
      Fix position of WalSndWakeupRequest call. · 3bb592bb
      Robert Haas authored
      This avoids discriminating against wal_sync_method = open_sync or
      open_datasync.
      
      Fujii Masao, reviewed by Andres Freund
      3bb592bb
    • Peter Eisentraut's avatar
      Assorted message style improvements · 2b443063
      Peter Eisentraut authored
      2b443063
    • Tom Lane's avatar
      Fix to_date's handling of year 519. · 41f4a0ab
      Tom Lane authored
      A thinko in commit 029dfdf1 caused the year
      519 to be handled differently from either adjacent year, which was not the
      intention AFAICS.  Report and diagnosis by Marc Cousin.
      
      In passing, remove redundant re-tests of year value.
      41f4a0ab
    • Robert Haas's avatar
      Work a little harder on comments for walsender wakeup patch. · 82cdd2df
      Robert Haas authored
      Per gripe from Tom Lane.
      82cdd2df
    • Robert Haas's avatar
      Make commit_delay much smarter. · f11e8be3
      Robert Haas authored
      Instead of letting every backend participating in a group commit wait
      independently, have the first one that becomes ready to flush WAL wait
      for the configured delay, and let all the others wait just long enough
      for that first process to complete its flush.  This greatly increases
      the chances of being able to configure a commit_delay setting that
      actually improves performance.
      
      As a side consequence of this change, commit_delay now affects all WAL
      flushes, rather than just commits.  There was some discussion on
      pgsql-hackers about whether to rename the GUC to, say, wal_flush_delay,
      but in the absence of consensus I am leaving it alone for now.
      
      Peter Geoghegan, with some changes, mostly to the documentation, by me.
      f11e8be3
    • Robert Haas's avatar
      Make walsender more responsive. · f83b5999
      Robert Haas authored
      Per testing by Andres Freund, this improves replication performance
      and reduces replication latency and latency jitter.  I was a bit
      concerned about moving more work into XLogInsert, but testing seems
      to show that it's not a problem in practice.
      
      Along the way, improve comments for WaitLatchOrSocket.
      
      Andres Freund.  Review and stylistic cleanup by me.
      f83b5999
  4. 01 Jul, 2012 2 commits
    • Tom Lane's avatar
      Fix race condition in enum value comparisons. · 9ad45c18
      Tom Lane authored
      When (re) loading the typcache comparison cache for an enum type's values,
      use an up-to-date MVCC snapshot, not the transaction's existing snapshot.
      This avoids problems if we encounter an enum OID that was created since our
      transaction started.  Per report from Andres Freund and diagnosis by Robert
      Haas.
      
      To ensure this is safe even if enum comparison manages to get invoked
      before we've set a transaction snapshot, tweak GetLatestSnapshot to
      redirect to GetTransactionSnapshot instead of throwing error when
      FirstSnapshotSet is false.  The existing uses of GetLatestSnapshot (in
      ri_triggers.c) don't care since they couldn't be invoked except in a
      transaction that's already done some work --- but it seems just conceivable
      that this might not be true of enums, especially if we ever choose to use
      enums in system catalogs.
      
      Note that the comparable coding in enum_endpoint and enum_range_internal
      remains GetTransactionSnapshot; this is perhaps debatable, but if we
      changed it those functions would have to be marked volatile, which doesn't
      seem attractive.
      
      Back-patch to 9.1 where ALTER TYPE ADD VALUE was added.
      9ad45c18
    • Tom Lane's avatar
      Suppress compiler warnings in readfuncs.c. · 39bfc94c
      Tom Lane authored
      Commit 7357558f introduced "(void) token;"
      into the READ_TEMP_LOCALS() macro, to suppress complaints from gcc 4.6
      when the value of token was not used anywhere in a particular node-read
      function.  However, this just moved the warning around: inspection of
      buildfarm results shows that some compilers are now complaining that token
      is being read before it's set.  Revert the READ_TEMP_LOCALS() macro change
      and instead put "(void) token;" into READ_NODE_FIELD(), which is the
      principal culprit for cases where the warning might occur.  In principle we
      might need the same in READ_BITMAPSET_FIELD() and/or READ_LOCATION_FIELD(),
      but it seems unlikely that a node would consist only of such fields, so
      I'll leave them alone for now.
      39bfc94c
  5. 30 Jun, 2012 5 commits
    • Tom Lane's avatar
      Remove inappropriate semicolons after function definitions. · fa188b5e
      Tom Lane authored
      Solaris Studio warns about this, and some compilers might think it's an
      outright syntax error.
      fa188b5e
    • Tom Lane's avatar
      Declare AnonymousShmem pointer as "void *". · 81e82643
      Tom Lane authored
      The original coding had it as "PGShmemHeader *", but that doesn't offer any
      notational benefit because we don't dereference it.  And it was resulting
      in compiler warnings on some platforms, notably buildfarm member
      castoroides, where mmap() and munmap() are evidently declared to take and
      return "char *".
      81e82643
    • Tom Lane's avatar
      Prevent CREATE TABLE LIKE/INHERITS from (mis) copying whole-row Vars. · 541ffa65
      Tom Lane authored
      If a CHECK constraint or index definition contained a whole-row Var (that
      is, "table.*"), an attempt to copy that definition via CREATE TABLE LIKE or
      table inheritance produced incorrect results: the copied Var still claimed
      to have the rowtype of the source table, rather than the created table.
      
      For the LIKE case, it seems reasonable to just throw error for this
      situation, since the point of LIKE is that the new table is not permanently
      coupled to the old, so there's no reason to assume its rowtype will stay
      compatible.  In the inheritance case, we should ideally allow such
      constraints, but doing so will require nontrivial refactoring of CREATE
      TABLE processing (because we'd need to know the OID of the new table's
      rowtype before we adjust inherited CHECK constraints).  In view of the lack
      of previous complaints, that doesn't seem worth the risk in a back-patched
      bug fix, so just make it throw error for the inheritance case as well.
      
      Along the way, replace change_varattnos_of_a_node() with a more robust
      function map_variable_attnos(), which is capable of being extended to
      handle insertion of ConvertRowtypeExpr whenever we get around to fixing
      the inheritance case nicely, and in the meantime it returns a failure
      indication to the caller so that a helpful message with some context can be
      thrown.  Also, this code will do the right thing with subselects (if we
      ever allow them in CHECK or indexes), and it range-checks varattnos before
      using them to index into the map array.
      
      Per report from Sergey Konoplev.  Back-patch to all supported branches.
      541ffa65
    • Peter Eisentraut's avatar
      initdb: Update check_need_password for new options · e4ffa86b
      Peter Eisentraut authored
      Change things so that something like initdb --auth-local=peer
      --auth-host=md5 does not cause a "must specify a password" error,
      like initdb -A md5 does.
      e4ffa86b
    • Heikki Linnakangas's avatar
      Validate xlog record header before enlarging the work area to store it. · 567787f2
      Heikki Linnakangas authored
      If the record header is garbled, we're now quite likely to notice it before
      we try to make a bogus memory allocation and run out of memory. That can
      still happen, if the xlog record is split across pages (we cannot verify
      the record header until reading the next page in that scenario), but this
      reduces the chances. An out-of-memory is treated as a corrupt record
      anyway, so this isn't a correctness issue, just a case of giving a better
      error message.
      
      Per Amit Kapila's suggestion.
      567787f2
  6. 29 Jun, 2012 6 commits
  7. 28 Jun, 2012 7 commits
    • Tom Lane's avatar
      Provide MAP_FAILED if sys/mman.h doesn't. · c1494b73
      Tom Lane authored
      On old HPUX this has to be #defined to -1.  It might be that other values
      are required on other dinosaur systems, but we'll worry about that when
      and if we get reports.
      c1494b73
    • Heikki Linnakangas's avatar
      Update outdated commit; xlp_rem_len field is in page header now. · 8f85667a
      Heikki Linnakangas authored
      Spotted by Amit Kapila
      8f85667a
    • Peter Eisentraut's avatar
      Further fix install program detection · dcd5af6c
      Peter Eisentraut authored
      The $(or) make function was introduced in GNU make 3.81, so the
      previous coding didn't work in 3.80.  Write it differently, and
      improve the variable naming to make more sense in the new coding.
      dcd5af6c
    • Robert Haas's avatar
      Fix broken mmap failure-detection code, and improve error message. · 39715af2
      Robert Haas authored
      Per an observation by Thom Brown that my previous commit made an
      overly large shmem allocation crash the server, on Linux.
      39715af2
    • Robert Haas's avatar
      Dramatically reduce System V shared memory consumption. · b0fc0df9
      Robert Haas authored
      Except when compiling with EXEC_BACKEND, we'll now allocate only a tiny
      amount of System V shared memory (as an interlock to protect the data
      directory) and allocate the rest as anonymous shared memory via mmap.
      This will hopefully spare most users the hassle of adjusting operating
      system parameters before being able to start PostgreSQL with a
      reasonable value for shared_buffers.
      
      There are a bunch of documentation updates needed here, and we might
      need to adjust some of the HINT messages related to shared memory as
      well.  But it's not 100% clear how portable this is, so before we
      write the documentation, let's give it a spin on the buildfarm and
      see what turns red.
      b0fc0df9
    • Robert Haas's avatar
      Add missing space in event_source GUC description. · c5b3451a
      Robert Haas authored
      This has apparently been wrong since event_source was added.
      
      Alexander Lakhin
      c5b3451a
    • Tom Lane's avatar
      Make UtilityContainsQuery recurse until it finds a non-utility Query. · bde689f8
      Tom Lane authored
      The callers of UtilityContainsQuery want it to return a non-utility Query
      if it returns anything at all.  However, since we made CREATE TABLE
      AS/SELECT INTO into a utility command instead of a variant of SELECT,
      a command like "EXPLAIN SELECT INTO" results in two nested utility
      statements.  So what we need UtilityContainsQuery to do is drill down
      to the bottom non-utility Query.
      
      I had thought of this possibility in setrefs.c, and fixed it there by
      looping around the UtilityContainsQuery call; but overlooked that the call
      sites in plancache.c have a similar issue.  In those cases it's
      notationally inconvenient to provide an external loop, so let's redefine
      UtilityContainsQuery as recursing down to a non-utility Query instead.
      
      Noted by Rushabh Lathia.  This is a somewhat cleaned-up version of his
      proposed patch.
      bde689f8