1. 24 9月, 2007 1 次提交
  2. 22 9月, 2007 1 次提交
    • T
      Make some simple performance improvements in TransactionIdIsInProgress(). · da072ab2
      Tom Lane 提交于
      For XIDs of our own transaction and subtransactions, it's cheaper to ask
      TransactionIdIsCurrentTransactionId() than to look in shared memory.
      Also, the xids[] work array is always the same size within any given
      process, so malloc it just once instead of doing a palloc/pfree on every
      call; aside from being faster this lets us get rid of some goto's, since
      we no longer have any end-of-function pfree to do.  Both ideas by Heikki.
      da072ab2
  3. 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
  4. 08 9月, 2007 1 次提交
    • T
      Don't take ProcArrayLock while exiting a transaction that has no XID; there is · 0a51e707
      Tom Lane 提交于
      no need for serialization against snapshot-taking because the xact doesn't
      affect anyone else's snapshot anyway.  Per discussion.  Also, move various
      info about the interlocking of transactions and snapshots out of code comments
      and into a hopefully-more-cohesive discussion in access/transam/README.
      
      Also, remove a couple of now-obsolete comments about having to force some WAL
      to be written to persuade RecordTransactionCommit to do its thing.
      0a51e707
  5. 07 9月, 2007 1 次提交
  6. 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
  7. 01 7月, 2007 1 次提交
  8. 30 6月, 2007 1 次提交
  9. 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
  10. 02 6月, 2007 1 次提交
  11. 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
  12. 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
  13. 23 3月, 2007 1 次提交
  14. 16 1月, 2007 1 次提交
  15. 06 1月, 2007 1 次提交
  16. 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
  17. 04 10月, 2006 1 次提交
  18. 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
  19. 31 7月, 2006 1 次提交
  20. 30 7月, 2006 1 次提交
  21. 14 7月, 2006 2 次提交
  22. 19 6月, 2006 1 次提交
  23. 05 3月, 2006 1 次提交
  24. 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
  25. 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
  26. 23 11月, 2005 1 次提交
  27. 15 10月, 2005 1 次提交
  28. 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
  29. 20 8月, 2005 1 次提交
  30. 01 8月, 2005 1 次提交
  31. 18 6月, 2005 1 次提交
  32. 20 5月, 2005 2 次提交