1. 27 6月, 2011 1 次提交
    • R
      Avoid having two copies of the HOT-chain search logic. · 4da99ea4
      Robert Haas 提交于
      It's been like this since HOT was originally introduced, but the logic
      is complex enough that this is a recipe for bugs, as we've already
      found out with SSI.  So refactor heap_hot_search_buffer() so that it
      can satisfy the needs of index_getnext(), and make index_getnext() use
      that rather than duplicating the logic.
      
      This change was originally proposed by Heikki Linnakangas as part of a
      larger refactoring oriented towards allowing index-only scans.  I
      extracted and adjusted this part, since it seems to have independent
      merit.  Review by Jeff Davis.
      4da99ea4
  2. 22 6月, 2011 2 次提交
    • R
      Make the visibility map crash-safe. · 503c7305
      Robert Haas 提交于
      This involves two main changes from the previous behavior.  First,
      when we set a bit in the visibility map, emit a new WAL record of type
      XLOG_HEAP2_VISIBLE.  Replay sets the page-level PD_ALL_VISIBLE bit and
      the visibility map bit.  Second, when inserting, updating, or deleting
      a tuple, we can no longer get away with clearing the visibility map
      bit after releasing the lock on the corresponding heap page, because
      an intervening crash might leave the visibility map bit set and the
      page-level bit clear.  Making this work requires a bit of interface
      refactoring.
      
      In passing, a few minor but related cleanups: change the test in
      visibilitymap_set and visibilitymap_clear to throw an error if the
      wrong page (or no page) is pinned, rather than silently doing nothing;
      this case should never occur.  Also, remove duplicate definitions of
      InvalidXLogRecPtr.
      
      Patch by me, review by Noah Misch.
      503c7305
    • P
      Message style and spelling improvements · e2a0cb1a
      Peter Eisentraut 提交于
      e2a0cb1a
  3. 16 6月, 2011 2 次提交
    • H
      cb94db91
    • S
      Respect Hot Standby controls while recycling btree index pages. · 758bd2a4
      Simon Riggs 提交于
      Btree pages were recycled after VACUUM deletes all records on a
      page and then a subsequent VACUUM occurs after the RecentXmin
      horizon is reached. Using RecentXmin meant that we did not respond
      correctly to the user controls provide to avoid Hot Standby
      conflicts and so spurious conflicts could be generated in some
      workload combinations. We now reuse pages only when we reach
      RecentGlobalXmin, which can be much later in the presence of long
      running queries and is also controlled by vacuum_defer_cleanup_age
      and hot_standby_feedback.
      
      Noah Misch and Simon Riggs
      758bd2a4
  4. 15 6月, 2011 1 次提交
  5. 14 6月, 2011 1 次提交
  6. 11 6月, 2011 1 次提交
    • T
      Work around gcc 4.6.0 bug that breaks WAL replay. · c2ba0121
      Tom Lane 提交于
      ReadRecord's habit of using both direct references to tmpRecPtr and
      references to *RecPtr (which is pointing at tmpRecPtr) triggers an
      optimization bug in gcc 4.6.0, which apparently has forgotten about
      aliasing rules.  Avoid the compiler bug, and make the code more readable
      to boot, by getting rid of the direct references.  Improve the comments
      while at it.
      
      Back-patch to all supported versions, in case they get built with 4.6.0.
      
      Tom Lane, with some cosmetic suggestions from Alex Hunsaker
      c2ba0121
  7. 10 6月, 2011 1 次提交
  8. 01 6月, 2011 1 次提交
    • T
      Protect GIST logic that assumes penalty values can't be negative. · 6923d699
      Tom Lane 提交于
      Apparently sane-looking penalty code might return small negative values,
      for example because of roundoff error.  This will confuse places like
      gistchoose().  Prevent problems by clamping negative penalty values to
      zero.  (Just to be really sure, I also made it force NaNs to zero.)
      Back-patch to all supported branches.
      
      Alexander Korotkov
      6923d699
  9. 31 5月, 2011 1 次提交
    • H
      The row-version chaining in Serializable Snapshot Isolation was still wrong. · 3103f9a7
      Heikki Linnakangas 提交于
      On further analysis, it turns out that it is not needed to duplicate predicate
      locks to the new row version at update, the lock on the version that the
      transaction saw as visible is enough. However, there was a different bug in
      the code that checks for dangerous structures when a new rw-conflict happens.
      Fix that bug, and remove all the row-version chaining related code.
      
      Kevin Grittner & Dan Ports, with some comment editorialization by me.
      3103f9a7
  10. 19 5月, 2011 1 次提交
  11. 12 5月, 2011 1 次提交
  12. 11 5月, 2011 1 次提交
  13. 07 5月, 2011 1 次提交
    • T
      Move RegisterPredicateLockingXid() call to a safer place. · d2088ae9
      Tom Lane 提交于
      The SSI patch inserted a call of RegisterPredicateLockingXid into
      GetNewTransactionId, which was a bad idea on a couple of grounds.  First,
      it's not necessary to hold XidGenLock while manipulating that shared
      memory, and doing so is bad because XidGenLock is a high-contention lock
      that should be held for as short a time as possible.  (Not to mention that
      it adds an entirely unnecessary deadlock hazard, since we must take
      SerializableXactHashLock as well.)  Second, the specific place where it was
      put was between extending CLOG and advancing nextXid, which could result in
      unpleasant behavior in case of a failure there.  Pull the call out to
      AssignTransactionId, which is much safer and arguably better from a
      modularity standpoint too.
      
      There is more work to do to clean up the failure-before-advancing-nextXid
      issue, but that is a separate change that will need to be back-patched.
      So for the moment I just want to make GetNewTransactionId look the same as
      it did in prior versions.
      d2088ae9
  14. 25 4月, 2011 1 次提交
  15. 24 4月, 2011 1 次提交
  16. 23 4月, 2011 2 次提交
    • T
      Make GIN and GIST pass the index collation to all their support functions. · ae20bf17
      Tom Lane 提交于
      Experimentation with contrib/btree_gist shows that the majority of the GIST
      support functions potentially need collation information.  Safest policy
      seems to be to pass it to all of them, instead of making assumptions about
      which ones could possibly need it.
      ae20bf17
    • T
      Make a code-cleanup pass over the collations patch. · 9e9b9ac7
      Tom Lane 提交于
      This patch is almost entirely cosmetic --- mostly cleaning up a lot of
      neglected comments, and fixing code layout problems in places where the
      patch made lines too long and then pgindent did weird things with that.
      I did find a bug-of-omission in equalTupleDescs().
      9e9b9ac7
  17. 18 4月, 2011 1 次提交
    • R
      recoveryStopsHere() must check the resource manager ID. · aea1f24c
      Robert Haas 提交于
      Before commit c016ce72, this wasn't
      needed, but now that multiple resource manager IDs can percolate down
      through here, we have to make sure we know which one we've got.
      Otherwise, we can confuse (for example) an XLOG_XACT_COMMIT record
      with an XLOG_CHECKPOINT_SHUTDOWN record.
      
      Review by Jaime Casanova
      aea1f24c
  18. 17 4月, 2011 1 次提交
  19. 14 4月, 2011 1 次提交
    • H
      Revert the patch to check if we've reached end-of-backup also when doing · 54685b1c
      Heikki Linnakangas 提交于
      crash recovery, and throw an error if not. hubert depesz lubaczewski pointed
      out that that situation also happens in the crash recovery following a
      system crash that happens during an online backup.
      
      We might want to do something smarter in 9.1, like put the check back for
      backups taken with pg_basebackup, but that's for another patch.
      54685b1c
  20. 13 4月, 2011 1 次提交
    • T
      Pass collations to functions in FunctionCallInfoData, not FmgrInfo. · d64713df
      Tom Lane 提交于
      Since collation is effectively an argument, not a property of the function,
      FmgrInfo is really the wrong place for it; and this becomes critical in
      cases where a cached FmgrInfo is used for varying purposes that might need
      different collation settings.  Fix by passing it in FunctionCallInfoData
      instead.  In particular this allows a clean fix for bug #5970 (record_cmp
      not working).  This requires touching a bit more code than the original
      method, but nobody ever thought that collations would not be an invasive
      patch...
      d64713df
  21. 12 4月, 2011 1 次提交
  22. 10 4月, 2011 1 次提交
  23. 09 4月, 2011 1 次提交
    • T
      Tweak collation setup for GIN index comparison functions. · 1766a5b6
      Tom Lane 提交于
      Honor index column's collation spec if there is one, don't go to the
      expense of calling get_typcollation when we can reasonably assume that
      all GIN storage types will use default collation, and be sure to set
      a collation for the comparePartialFn too.
      1766a5b6
  24. 07 4月, 2011 1 次提交
    • T
      Revise the API for GUC variable assign hooks. · 2594cf0e
      Tom Lane 提交于
      The previous functions of assign hooks are now split between check hooks
      and assign hooks, where the former can fail but the latter shouldn't.
      Aside from being conceptually clearer, this approach exposes the
      "canonicalized" form of the variable value to guc.c without having to do
      an actual assignment.  And that lets us fix the problem recently noted by
      Bernd Helmle that the auto-tune patch for wal_buffers resulted in bogus
      log messages about "parameter "wal_buffers" cannot be changed without
      restarting the server".  There may be some speed advantage too, because
      this design lets hook functions avoid re-parsing variable values when
      restoring a previous state after a rollback (they can store a pre-parsed
      representation of the value instead).  This patch also resolves a
      longstanding annoyance about custom error messages from variable assign
      hooks: they should modify, not appear separately from, guc.c's own message
      about "invalid parameter value".
      2594cf0e
  25. 05 4月, 2011 2 次提交
  26. 31 3月, 2011 1 次提交
  27. 30 3月, 2011 1 次提交
    • H
      Check that we've reached end-of-backup also when we're not performing · acf47401
      Heikki Linnakangas 提交于
      archive recovery.
      
      It's possible to restore an online backup without recovery.conf, by simply
      copying all the necessary WAL files to pg_xlog. "pg_basebackup -x" does that
      too. That's the use case where this cross-check is useful.
      
      Backpatch to 9.0. We used to do this in earlier versins, but in 9.0 the code
      was inadvertently changed so that the check is only performed after archive
      recovery.
      
      Fujii Masao.
      acf47401
  28. 27 3月, 2011 1 次提交
  29. 24 3月, 2011 1 次提交
    • S
      Minor changes to recovery pause behaviour. · b5f2f2a7
      Simon Riggs 提交于
      Change location LOG message so it works each time we pause, not
      just for final pause.
      Ensure that we pause only if we are in Hot Standby and can connect
      to allow us to run resume function. This change supercedes the
      code to override parameter recoveryPauseAtTarget to false if not
      attempting to enter Hot Standby, which is now removed.
      b5f2f2a7
  30. 23 3月, 2011 1 次提交
  31. 21 3月, 2011 1 次提交
  32. 20 3月, 2011 1 次提交
    • T
      Revise collation derivation method and expression-tree representation. · b310b6e3
      Tom Lane 提交于
      All expression nodes now have an explicit output-collation field, unless
      they are known to only return a noncollatable data type (such as boolean
      or record).  Also, nodes that can invoke collation-aware functions store
      a separate field that is the collation value to pass to the function.
      This avoids confusion that arises when a function has collatable inputs
      and noncollatable output type, or vice versa.
      
      Also, replace the parser's on-the-fly collation assignment method with
      a post-pass over the completed expression tree.  This allows us to use
      a more complex (and hopefully more nearly spec-compliant) assignment
      rule without paying for it in extra storage in every expression node.
      
      Fix assorted bugs in the planner's handling of collations by making
      collation one of the defining properties of an EquivalenceClass and
      by converting CollateExprs into discardable RelabelType nodes during
      expression preprocessing.
      b310b6e3
  33. 18 3月, 2011 2 次提交
  34. 11 3月, 2011 2 次提交