1. 07 9月, 2007 1 次提交
  2. 06 9月, 2007 2 次提交
    • T
      Volatile-qualify the ProcArray PGPROC pointer in a bunch of routines · 0ecb4ea7
      Tom Lane 提交于
      that examine fields that could change under them.  This is just to make
      really sure that when we are fetching a value 'only once', that's what
      actually happens.  Possibly this is a bug that should be back-patched,
      but in the absence of solid evidence that it's needed, I won't bother.
      0ecb4ea7
    • 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
  3. 01 7月, 2007 1 次提交
  4. 30 6月, 2007 1 次提交
  5. 08 6月, 2007 1 次提交
    • T
      Redefine IsTransactionState() to only return true for TRANS_INPROGRESS state, · 6d6d14b6
      Tom Lane 提交于
      which is the only state in which it's safe to initiate database queries.
      It turns out that all but two of the callers thought that's what it meant;
      and the other two were using it as a proxy for "will GetTopTransactionId()
      return a nonzero XID"?  Since it was in fact an unreliable guide to that,
      make those two just invoke GetTopTransactionId() always, then deal with a
      zero result if they get one.
      6d6d14b6
  6. 02 6月, 2007 1 次提交
  7. 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
  8. 26 3月, 2007 1 次提交
    • T
      Clean up the representation of special snapshots by including a "method · e85a01df
      Tom Lane 提交于
      pointer" in every Snapshot struct.  This allows removal of the case-by-case
      tests in HeapTupleSatisfiesVisibility, which should make it a bit faster
      (I didn't try any performance tests though).  More importantly, we are no
      longer violating portable C practices by assuming that small integers are
      distinct from all pointer values, and HeapTupleSatisfiesDirty no longer
      has a non-reentrant API involving side-effects on a global variable.
      
      There were a couple of places calling HeapTupleSatisfiesXXX routines
      directly rather than through the HeapTupleSatisfiesVisibility macro.
      Since these places had to be changed anyway, I chose to make them go
      through the macro for uniformity.
      
      Along the way I renamed HeapTupleSatisfiesSnapshot to HeapTupleSatisfiesMVCC
      to emphasize that it's only used with MVCC-type snapshots.  I was sorely
      tempted to rename HeapTupleSatisfiesVisibility to HeapTupleSatisfiesSnapshot,
      but forebore for the moment to avoid confusion and reduce the likelihood that
      this patch breaks some of the pending patches.  Might want to reconsider
      doing that later.
      e85a01df
  9. 23 3月, 2007 1 次提交
  10. 16 1月, 2007 1 次提交
  11. 06 1月, 2007 1 次提交
  12. 06 11月, 2006 1 次提交
    • T
      Fix recently-understood problems with handling of XID freezing, particularly · 48188e16
      Tom Lane 提交于
      in PITR scenarios.  We now WAL-log the replacement of old XIDs with
      FrozenTransactionId, so that such replacement is guaranteed to propagate to
      PITR slave databases.  Also, rather than relying on hint-bit updates to be
      preserved, pg_clog is not truncated until all instances of an XID are known to
      have been replaced by FrozenTransactionId.  Add new GUC variables and
      pg_autovacuum columns to allow management of the freezing policy, so that
      users can trade off the size of pg_clog against the amount of freezing work
      done.  Revise the already-existing code that forces autovacuum of tables
      approaching the wraparound point to make it more bulletproof; also, revise the
      autovacuum logic so that anti-wraparound vacuuming is done per-table rather
      than per-database.  initdb forced because of changes in pg_class, pg_database,
      and pg_autovacuum catalogs.  Heikki Linnakangas, Simon Riggs, and Tom Lane.
      48188e16
  13. 04 10月, 2006 1 次提交
  14. 03 9月, 2006 1 次提交
    • T
      Arrange for GetSnapshotData to copy live-subtransaction XIDs from the · 8fad2e3f
      Tom Lane 提交于
      PGPROC array into snapshots, and use this information to avoid visits
      to pg_subtrans in HeapTupleSatisfiesSnapshot.  This appears to solve
      the pg_subtrans-related context swap storm problem that's been reported
      by several people for 8.1.  While at it, modify GetSnapshotData to not
      take an exclusive lock on ProcArrayLock, as closer analysis shows that
      shared lock is always sufficient.
      Itagaki Takahiro and Tom Lane
      8fad2e3f
  15. 31 7月, 2006 1 次提交
  16. 30 7月, 2006 1 次提交
  17. 14 7月, 2006 2 次提交
  18. 19 6月, 2006 1 次提交
  19. 05 3月, 2006 1 次提交
  20. 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
  21. 12 12月, 2005 1 次提交
    • T
      Divide the lock manager's shared state into 'partitions', so as to · ec0baf94
      Tom Lane 提交于
      reduce contention for the former single LockMgrLock.  Per my recent
      proposal.  I set it up for 16 partitions, but on a pgbench test this
      gives only a marginal further improvement over 4 partitions --- we need
      to test more scenarios to choose the number of partitions.
      ec0baf94
  22. 23 11月, 2005 1 次提交
  23. 15 10月, 2005 1 次提交
  24. 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
  25. 20 8月, 2005 1 次提交
  26. 01 8月, 2005 1 次提交
  27. 18 6月, 2005 1 次提交
  28. 20 5月, 2005 2 次提交