1. 09 12月, 2010 1 次提交
  2. 07 12月, 2010 1 次提交
    • H
      Fix bugs in the hot standby known-assigned-xids tracking logic. If there's · 5a031a55
      Heikki Linnakangas 提交于
      an old transaction running in the master, and a lot of transactions have
      started and finished since, and a WAL-record is written in the gap between
      the creating the running-xacts snapshot and WAL-logging it, recovery will fail
      with "too many KnownAssignedXids" error. This bug was reported by
      Joachim Wieland on Nov 19th.
      
      In the same scenario, when fewer transactions have started so that all the
      xids fit in KnownAssignedXids despite the first bug, a more serious bug
      arises. We incorrectly initialize the clog code with the oldest still running
      transaction, and when we see the WAL record belonging to a transaction with
      an XID larger than one that committed already before the checkpoint we're
      recovering from, we zero the clog page containing the already committed
      transaction, leading to data loss.
      
      In hindsight, trying to track xids in the known-assigned-xids array before
      seeing the running-xacts record was too complicated. To fix that, hold
      XidGenLock while the running-xacts snapshot is taken and WAL-logged. That
      ensures that no transaction can begin or end in that gap, so that in recvoery
      we know that the snapshot contains all transactions running at that point in
      WAL.
      5a031a55
  3. 21 9月, 2010 1 次提交
  4. 31 8月, 2010 1 次提交
  5. 30 8月, 2010 1 次提交
  6. 13 8月, 2010 1 次提交
  7. 07 7月, 2010 1 次提交
  8. 04 7月, 2010 1 次提交
    • T
      Make vacuum_defer_cleanup_age be PGC_SIGHUP level, since it's not sensible · aceedd88
      Tom Lane 提交于
      to have different values in different processes of the primary server.
      Also put it into the "Streaming Replication" GUC category; it doesn't belong
      in "Standby Servers" because you use it on the master not the standby.
      In passing also correct guc.c's idea of wal_keep_segments' category.
      aceedd88
  9. 14 5月, 2010 1 次提交
  10. 13 5月, 2010 1 次提交
    • S
      Cleanup initialization of Hot Standby. Clarify working with reanalysis · 8431e296
      Simon Riggs 提交于
      of requirements and documentation on LogStandbySnapshot(). Fixes
      two minor bugs reported by Tom Lane that would lead to an incorrect
      snapshot after transaction wraparound. Also fix two other problems
      discovered that would give incorrect snapshots in certain cases.
      ProcArrayApplyRecoveryInfo() substantially rewritten. Some minor
      refactoring of xact_redo_apply() and ExpireTreeKnownAssignedTransactionIds().
      8431e296
  11. 30 4月, 2010 1 次提交
  12. 28 4月, 2010 1 次提交
  13. 22 4月, 2010 2 次提交
    • S
      Optimise btree delete processing when no active backends. · a2555571
      Simon Riggs 提交于
      Clarify comments, downgrade a message to DEBUG and remove some
      debug counters. Direct from ideas by Heikki Linnakangas.
      a2555571
    • S
      Relax locking during GetCurrentVirtualXIDs(). Earlier improvements · 0192abc4
      Simon Riggs 提交于
      to handling of btree delete records mean that all snapshot
      conflicts on standby now have a valid, useful latestRemovedXid.
      Our earlier approach using LW_EXCLUSIVE was useful when we didnt
      always have a valid value, though is no longer useful or necessary.
      Asserts added to code path to prove and ensure this is the case.
      This will reduce contention and improve performance of larger Hot
      Standby servers.
      0192abc4
  14. 20 4月, 2010 1 次提交
  15. 19 4月, 2010 1 次提交
  16. 06 4月, 2010 1 次提交
  17. 11 3月, 2010 1 次提交
  18. 26 2月, 2010 1 次提交
  19. 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
  20. 21 1月, 2010 1 次提交
  21. 17 1月, 2010 1 次提交
  22. 16 1月, 2010 1 次提交
    • S
      Teach standby conflict resolution to use SIGUSR1 · a8ce974c
      Simon Riggs 提交于
      Conflict reason is passed through directly to the backend, so we can
      take decisions about the effect of the conflict based upon the local
      state. No specific changes, as yet, though this prepares for later work.
      CancelVirtualTransaction() sends signals while holding ProcArrayLock.
      Introduce errdetail_abort() to give message detail explaining that the
      abort was caused by conflict processing. Remove CONFLICT_MODE states
      in favour of using PROCSIG_RECOVERY_CONFLICT states directly, for clarity.
      a8ce974c
  23. 10 1月, 2010 1 次提交
    • S
      During Hot Standby, fix drop database when sessions idle. · 3bfcccc2
      Simon Riggs 提交于
      Previously we only cancelled sessions that were in-transaction.
      
      Simple fix is to just cancel all sessions without waiting. Doing
      it this way avoids complicating common code paths, which would
      not be worth the trouble to cover this rare case.
      
      Problem report and fix by Andres Freund, edited somewhat by me
      3bfcccc2
  24. 03 1月, 2010 1 次提交
  25. 01 1月, 2010 1 次提交
  26. 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
  27. 29 7月, 2009 1 次提交
  28. 11 6月, 2009 1 次提交
  29. 05 4月, 2009 1 次提交
    • T
      A session that does not have any live snapshots does not have to be waited for · c973051a
      Tom Lane 提交于
      when we are waiting for old snapshots to go away during a concurrent index
      build.  In particular, this rule lets us avoid waiting for
      idle-in-transaction sessions.
      
      This logic could be improved further if we had some way to wake up when
      the session we are currently waiting for goes idle-in-transaction.  However
      that would be a significantly more complex/invasive patch, so it'll have to
      wait for some other day.
      
      Simon Riggs, with some improvements by Tom.
      c973051a
  30. 31 3月, 2009 1 次提交
    • H
      Fix a rare race condition when commit_siblings > 0 and a transaction commits · eeeb782e
      Heikki Linnakangas 提交于
      at the same instant as a new backend is spawned. Since CountActiveBackends()
      doesn't hold ProcArrayLock, it needs to be prepared for the case that a
      pointer at the end of the proc array is still NULL even though numProcs says
      it should be valid, since it doesn't hold ProcArrayLock. Backpatch to 8.1.
      8.0 and earlier had this right, but it was broken in the split of PGPROC and
      sinval shared memory arrays.
      
      Per report and proposal by Marko Kreen.
      eeeb782e
  31. 02 1月, 2009 1 次提交
  32. 05 8月, 2008 1 次提交
    • T
      Improve CREATE/DROP/RENAME DATABASE so that when failing because the source · 4abd7b49
      Tom Lane 提交于
      or target database is being accessed by other users, it tells you whether
      the "other users" are live sessions or uncommitted prepared transactions.
      (Indeed, it tells you exactly how many of each, but that's mostly just
      because it was easy to do so.)  This should help forestall the gotcha of
      not realizing that a prepared transaction is what's blocking the command.
      Per discussion.
      4abd7b49
  33. 11 7月, 2008 1 次提交
  34. 13 5月, 2008 1 次提交
    • A
      Improve snapshot manager by keeping explicit track of snapshots. · 5da9da71
      Alvaro Herrera 提交于
      There are two ways to track a snapshot: there's the "registered" list, which
      is used for arbitrary long-lived snapshots; and there's the "active stack",
      which is used for the snapshot that is considered "active" at any time.
      This also allows users of snapshots to stop worrying about snapshot memory
      allocation and freeing, and about using PG_TRY blocks around ActiveSnapshot
      assignment.  This is all done automatically now.
      
      As a consequence, this allows us to reset MyProc->xmin when there are no
      more snapshots registered in the current backend, reducing the impact that
      long-running transactions have on VACUUM.
      5da9da71
  35. 27 3月, 2008 2 次提交
  36. 12 3月, 2008 1 次提交
    • T
      Make TransactionIdIsInProgress check transam.c's single-item XID status cache · 611b4393
      Tom Lane 提交于
      before it goes groveling through the ProcArray.  In situations where the same
      recently-committed transaction ID is checked repeatedly by tqual.c, this saves
      a lot of shared-memory searches.  And it's cheap enough that it shouldn't
      hurt noticeably when it doesn't help.
      Concept and patch by Simon, some minor tweaking and comment-cleanup by Tom.
      611b4393
  37. 10 1月, 2008 1 次提交
  38. 02 1月, 2008 1 次提交