1. 29 8月, 2012 1 次提交
    • A
      Split resowner.h · 45326c5a
      Alvaro Herrera 提交于
      This lets files that are mere users of ResourceOwner not automatically
      include the headers for stuff that is managed by the resowner mechanism.
      45326c5a
  2. 02 1月, 2012 1 次提交
  3. 23 10月, 2011 1 次提交
    • T
      Support synchronization of snapshots through an export/import procedure. · bb446b68
      Tom Lane 提交于
      A transaction can export a snapshot with pg_export_snapshot(), and then
      others can import it with SET TRANSACTION SNAPSHOT.  The data does not
      leave the server so there are not security issues.  A snapshot can only
      be imported while the exporting transaction is still running, and there
      are some other restrictions.
      
      I'm not totally convinced that we've covered all the bases for SSI (true
      serializable) mode, but it works fine for lesser isolation modes.
      
      Joachim Wieland, reviewed by Marko Tiikkaja, and rather heavily modified
      by Tom Lane
      bb446b68
  4. 27 9月, 2011 1 次提交
    • T
      Allow snapshot references to still work during transaction abort. · 57eb0090
      Tom Lane 提交于
      In REPEATABLE READ (nee SERIALIZABLE) mode, an attempt to do
      GetTransactionSnapshot() between AbortTransaction and CleanupTransaction
      failed, because GetTransactionSnapshot would recompute the transaction
      snapshot (which is already wrong, given the isolation mode) and then
      re-register it in the TopTransactionResourceOwner, leading to an Assert
      because the TopTransactionResourceOwner should be empty of resources after
      AbortTransaction.  This is the root cause of bug #6218 from Yamamoto
      Takashi.  While changing plancache.c to avoid requesting a snapshot when
      handling a ROLLBACK masks the problem, I think this is really a snapmgr.c
      bug: it's lower-level than the resource manager mechanism and should not be
      shutting itself down before we unwind resource manager resources.  However,
      just postponing the release of the transaction snapshot until cleanup time
      didn't work because of the circular dependency with
      TopTransactionResourceOwner.  Fix by managing the internal reference to
      that snapshot manually instead of depending on TopTransactionResourceOwner.
      This saves a few cycles as well as making the module layering more
      straightforward.  predicate.c's dependencies on TopTransactionResourceOwner
      go away too.
      
      I think this is a longstanding bug, but there's no evidence that it's more
      than a latent bug, so it doesn't seem worth any risk of back-patching.
      57eb0090
  5. 01 9月, 2011 1 次提交
  6. 01 3月, 2011 1 次提交
    • T
      Rearrange snapshot handling to make rule expansion more consistent. · c0b00760
      Tom Lane 提交于
      With this patch, portals, SQL functions, and SPI all agree that there
      should be only a CommandCounterIncrement between the queries that are
      generated from a single SQL command by rule expansion.  Fetching a whole
      new snapshot now happens only between original queries.  This is equivalent
      to the existing behavior of EXPLAIN ANALYZE, and it was judged to be the
      best choice since it eliminates one source of concurrency hazards for
      rules.  The patch should also make things marginally faster by reducing the
      number of snapshot push/pop operations.
      
      The patch removes pg_parse_and_rewrite(), which is no longer used anywhere.
      There was considerable discussion about more aggressive refactoring of the
      query-processing functions exported by postgres.c, but for the moment
      nothing more has been done there.
      
      I also took the opportunity to refactor snapmgr.c's API slightly: the
      former PushUpdatedSnapshot() has been split into two functions.
      
      Marko Tiikkaja, reviewed by Steve Singer and Tom Lane
      c0b00760
  7. 02 1月, 2011 1 次提交
  8. 21 9月, 2010 1 次提交
  9. 03 1月, 2010 1 次提交
  10. 08 10月, 2009 1 次提交
    • A
      Fix snapshot management, take two. · 07cefdfb
      Alvaro Herrera 提交于
      Partially revert the previous patch I installed and replace it with a more
      general fix: any time a snapshot is pushed as Active, we need to ensure that it
      will not be modified in the future.  This means that if the same snapshot is
      used as CurrentSnapshot, it needs to be copied separately.  This affects
      serializable transactions only, because CurrentSnapshot has already been copied
      by RegisterSnapshot and so PushActiveSnapshot does not think it needs another
      copy.  However, CommandCounterIncrement would modify CurrentSnapshot, whereas
      ActiveSnapshots must not have their command counters incremented.
      
      I say "partially" because the regression test I added for the previous bug
      has been kept.
      
      (This restores 8.3 behavior, because before snapmgr.c existed, any snapshot set
      as Active was copied.)
      
      Per bug report from Stuart Bishop in
      6bc73d4c0910042358k3d1adff3qa36f8df75198ecea@mail.gmail.com
      07cefdfb
  11. 03 10月, 2009 1 次提交
    • A
      Ensure that a cursor has an immutable snapshot throughout its lifespan. · caa4cfa3
      Alvaro Herrera 提交于
      The old coding was using a regular snapshot, referenced elsewhere, that was
      subject to having its command counter updated.  Fix by creating a private copy
      of the snapshot exclusively for the cursor.
      
      Backpatch to 8.4, which is when the bug was introduced during the snapshot
      management rewrite.
      caa4cfa3
  12. 11 6月, 2009 1 次提交
  13. 02 1月, 2009 1 次提交
  14. 04 12月, 2008 1 次提交
    • A
      Fix a couple of snapshot management bugs in the new ResourceOwner world: · 7b640b03
      Alvaro Herrera 提交于
      non-writable large objects need to have their snapshots registered on the
      transaction resowner, not the current portal's, because it must persist until
      the large object is closed (which the portal does not).  Also, ensure that the
      serializable snapshot is recorded by the transaction resource owner too, even
      when a subtransaction has changed the current resource owner before
      serializable is taken.
      
      Per bug reports from Pavan Deolasee.
      7b640b03
  15. 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
  16. 27 3月, 2008 2 次提交