1. 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
  2. 03 1月, 2010 1 次提交
  3. 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
  4. 11 6月, 2009 1 次提交
  5. 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
  6. 02 1月, 2009 1 次提交
  7. 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
  8. 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
  9. 27 3月, 2008 1 次提交
    • A
      Separate snapshot management code from tuple visibility code, create a · d43b085d
      Alvaro Herrera 提交于
      snapmgmt.c file for the former.  The header files have also been reorganized
      in three parts: the most basic snapshot definitions are now in a new file
      snapshot.h, and the also new snapmgmt.h keeps the definitions for snapmgmt.c.
      tqual.h has been reduced to the bare minimum.
      
      This patch is just a first step towards managing live snapshots within a
      transaction; there is no functionality change.
      
      Per my proposal to pgsql-patches on 20080318191940.GB27458@alvh.no-ip.org and
      subsequent discussion.
      d43b085d
  10. 10 1月, 2008 1 次提交
  11. 02 1月, 2008 1 次提交
  12. 16 11月, 2007 1 次提交
  13. 09 9月, 2007 1 次提交
    • T
      Replace the former method of determining snapshot xmax --- to wit, calling · 6bd4f401
      Tom Lane 提交于
      ReadNewTransactionId from GetSnapshotData --- with a "latestCompletedXid"
      variable that is updated during transaction commit or abort.  Since
      latestCompletedXid is written only in places that had to lock ProcArrayLock
      exclusively anyway, and is read only in places that had to lock ProcArrayLock
      shared anyway, it adds no new locking requirements to the system despite being
      cluster-wide.  Moreover, removing ReadNewTransactionId from snapshot
      acquisition eliminates the need to take both XidGenLock and ProcArrayLock at
      the same time.  Since XidGenLock is sometimes held across I/O this can be a
      significant win.  Some preliminary benchmarking suggested that this patch has
      no effect on average throughput but can significantly improve the worst-case
      transaction times seen in pgbench.  Concept by Florian Pflug, implementation
      by Tom Lane.
      6bd4f401
  14. 07 9月, 2007 1 次提交
  15. 06 9月, 2007 1 次提交
    • T
      Implement lazy XID allocation: transactions that do not modify any database · 295e6398
      Tom Lane 提交于
      rows will normally never obtain an XID at all.  We already did things this way
      for subtransactions, but this patch extends the concept to top-level
      transactions.  In applications where there are lots of short read-only
      transactions, this should improve performance noticeably; not so much from
      removal of the actual XID-assignments, as from reduction of overhead that's
      driven by the rate of XID consumption.  We add a concept of a "virtual
      transaction ID" so that active transactions can be uniquely identified even
      if they don't have a regular XID.  This is a much lighter-weight concept:
      uniqueness of VXIDs is only guaranteed over the short term, and no on-disk
      record is made about them.
      
      Florian Pflug, with some editorialization by Tom.
      295e6398
  16. 02 6月, 2007 1 次提交
  17. 04 4月, 2007 1 次提交
    • T
      Remove the CheckpointStartLock in favor of having backends show whether they · 9c9b6194
      Tom Lane 提交于
      are in their commit critical sections via flags in the ProcArray.  Checkpoint
      can watch the ProcArray to determine when it's safe to proceed.  This is
      a considerably better solution to the original problem of race conditions
      between checkpoint and transaction commit: it speeds up commit, since there's
      one less lock to fool with, and it prevents the problem of checkpoint being
      delayed indefinitely when there's a constant flow of commits.  Heikki, with
      some kibitzing from Tom.
      9c9b6194
  18. 16 1月, 2007 1 次提交
  19. 06 1月, 2007 1 次提交
  20. 30 7月, 2006 1 次提交
  21. 19 6月, 2006 1 次提交
  22. 05 3月, 2006 1 次提交
  23. 16 12月, 2005 1 次提交
    • T
      Rethink prior patch to filter out dead backend entries from the pgstats · fb3dbdf9
      Tom Lane 提交于
      file.  The original code probed the PGPROC array separately for each PID,
      which was not good for large numbers of backends: not only is the runtime
      O(N^2) but most of it is spent holding ProcArrayLock.  Instead, take the
      lock just once and copy the active PIDs into an array, then use qsort
      and bsearch so that the lookup time is more like O(N log N).
      fb3dbdf9
  24. 15 10月, 2005 1 次提交
  25. 21 8月, 2005 1 次提交
    • T
      Convert the arithmetic for shared memory size calculation from 'int' · 0007490e
      Tom Lane 提交于
      to 'Size' (that is, size_t), and install overflow detection checks in it.
      This allows us to remove the former arbitrary restrictions on NBuffers
      etc.  It won't make any difference in a 32-bit machine, but in a 64-bit
      machine you could theoretically have terabytes of shared buffers.
      (How efficiently we could manage 'em remains to be seen.)  Similarly,
      num_temp_buffers, work_mem, and maintenance_work_mem can be set above
      2Gb on a 64-bit machine.  Original patch from Koichi Suzuki, additional
      work by moi.
      0007490e
  26. 20 8月, 2005 1 次提交
  27. 01 8月, 2005 1 次提交
  28. 18 6月, 2005 1 次提交
  29. 20 5月, 2005 1 次提交