1. 19 Jun, 2007 1 commit
    • Tom Lane's avatar
      Code review for log_lock_waits patch. Don't try to issue log messages from · 6e072287
      Tom Lane authored
      within a signal handler (this might be safe given the relatively narrow code
      range in which the interrupt is enabled, but it seems awfully risky); do issue
      more informative log messages that tell what is being waited for and the exact
      length of the wait; minor other code cleanup.  Greg Stark and Tom Lane
      6e072287
  2. 05 Jan, 2007 1 commit
  3. 04 Oct, 2006 1 commit
  4. 22 Sep, 2006 1 commit
  5. 18 Aug, 2006 1 commit
  6. 31 Jul, 2006 1 commit
    • Tom Lane's avatar
      Change the relation_open protocol so that we obtain lock on a relation · 09d3670d
      Tom Lane authored
      (table or index) before trying to open its relcache entry.  This fixes
      race conditions in which someone else commits a change to the relation's
      catalog entries while we are in process of doing relcache load.  Problems
      of that ilk have been reported sporadically for years, but it was not
      really practical to fix until recently --- for instance, the recent
      addition of WAL-log support for in-place updates helped.
      
      Along the way, remove pg_am.amconcurrent: all AMs are now expected to support
      concurrent update.
      09d3670d
  7. 14 Jul, 2006 2 commits
  8. 04 May, 2006 1 commit
    • Tom Lane's avatar
      Rethink the locking mechanisms used for CREATE/DROP/RENAME DATABASE. · 52667d56
      Tom Lane authored
      The former approach used ExclusiveLock on pg_database, which being a
      cluster-wide lock meant only one of these operations could proceed at
      a time; worse, it also blocked all incoming connections in ReverifyMyDatabase.
      Now that we have LockSharedObject(), we can use locks of different types
      applied to databases considered as objects.  This allows much more
      flexible management of the interlocking: two CREATE DATABASEs need not
      block each other, and need not block connections except to the template
      database being used.  Similarly DROP DATABASE doesn't block unrelated
      operations.  The locking used in flatfiles.c is also much narrower in
      scope than before.  Per recent proposal.
      52667d56
  9. 05 Mar, 2006 1 commit
  10. 13 Jan, 2006 1 commit
    • Tom Lane's avatar
      Remove logic in XactLockTableWait() that attempted to mark a crashed · 39fc1fb0
      Tom Lane authored
      transaction as aborted.  Since we only call XactLockTableWait on XIDs
      that we believe to be currently running, the odds of this code ever
      actually firing are minimal.  It's certainly unnecessary, since a
      transaction that's not either running or committed will be presumed
      aborted anyway.  What's more, it's not hard to imagine scenarios where
      this could result in corrupting pg_clog: for instance, if a bogus XID
      somehow got passed to XactLockTableWait.  I think the code probably
      dates from the ancient era when we didn't have TransactionIdIsInProgress;
      back then it may have been necessary, but now I think it's a waste of
      cycles and potentially dangerous.  Per discussion with Qingqing Zhou
      and Karsten Hilbert.
      39fc1fb0
  11. 09 Dec, 2005 1 commit
    • Tom Lane's avatar
      Simplify lock manager data structures by making a clear separation between · c599a247
      Tom Lane authored
      the data defining the semantics of a lock method (ie, conflict resolution
      table and ancillary data, which is all constant) and the hash tables
      storing the current state.  The only thing we give up by this is the
      ability to use separate hashtables for different lock methods, but there
      is no need for that anyway.  Put some extra fields into the LockMethod
      definition structs to clean up some other uglinesses, like hard-wired
      tests for DEFAULT_LOCKMETHOD and USER_LOCKMETHOD.  This commit doesn't
      do anything about the performance issues we were discussing, but it clears
      away some of the underbrush that's in the way of fixing that.
      c599a247
  12. 15 Oct, 2005 1 commit
  13. 01 Aug, 2005 1 commit
  14. 17 Jun, 2005 1 commit
  15. 14 Jun, 2005 1 commit
    • Tom Lane's avatar
      Simplify shared-memory lock data structures as per recent discussion: · 8563ccae
      Tom Lane authored
      it is sufficient to track whether a backend holds a lock or not, and
      store information about transaction vs. session locks only in the
      inside-the-backend LocalLockTable.  Since there can now be but one
      PROCLOCK per lock per backend, LockCountMyLocks() is no longer needed,
      thus eliminating some O(N^2) behavior when a backend holds many locks.
      Also simplify the LockAcquire/LockRelease API by passing just a
      'sessionLock' boolean instead of a transaction ID.  The previous API
      was designed with the idea that per-transaction lock holding would be
      important for subtransactions, but now that we have subtransactions we
      know that this is unwanted.  While at it, add an 'isTempObject' parameter
      to LockAcquire to indicate whether the lock is being taken on a temp
      table.  This is not used just yet, but will be needed shortly for
      two-phase commit.
      8563ccae
  16. 29 May, 2005 1 commit
    • Tom Lane's avatar
      Improve LockAcquire API per my recent proposal. All error conditions · 140b078d
      Tom Lane authored
      are now reported via elog, eliminating the need to test the result code
      at most call sites.  Make it possible for the caller to distinguish a
      freshly acquired lock from one already held in the current transaction.
      Use that capability to avoid redundant AcceptInvalidationMessages() calls
      in LockRelation().
      140b078d
  17. 19 May, 2005 1 commit
  18. 30 Apr, 2005 1 commit
  19. 29 Apr, 2005 1 commit
    • Tom Lane's avatar
      Restructure LOCKTAG as per discussions of a couple months ago. · 3a694bb0
      Tom Lane authored
      Essentially, we shoehorn in a lockable-object-type field by taking
      a byte away from the lockmethodid, which can surely fit in one byte
      instead of two.  This allows less artificial definitions of all the
      other fields of LOCKTAG; we can get rid of the special pg_xactlock
      pseudo-relation, and also support locks on individual tuples and
      general database objects (including shared objects).  None of those
      possibilities are actually exploited just yet, however.
      
      I removed pg_xactlock from pg_class, but did not force initdb for
      that change.  At this point, relkind 's' (SPECIAL) is unused and
      could be removed entirely.
      3a694bb0
  20. 31 Dec, 2004 1 commit
    • PostgreSQL Daemon's avatar
      · 2ff50159
      PostgreSQL Daemon authored
      Tag appropriate files for rc3
      
      Also performed an initial run through of upgrading our Copyright date to
      extend to 2005 ... first run here was very simple ... change everything
      where: grep 1996-2004 && the word 'Copyright' ... scanned through the
      generated list with 'less' first, and after, to make sure that I only
      picked up the right entries ...
      2ff50159
  21. 16 Sep, 2004 1 commit
    • Tom Lane's avatar
      Restructure subtransaction handling to reduce resource consumption, · 8f9f1986
      Tom Lane authored
      as per recent discussions.  Invent SubTransactionIds that are managed like
      CommandIds (ie, counter is reset at start of each top transaction), and
      use these instead of TransactionIds to keep track of subtransaction status
      in those modules that need it.  This means that a subtransaction does not
      need an XID unless it actually inserts/modifies rows in the database.
      Accordingly, don't assign it an XID nor take a lock on the XID until it
      tries to do that.  This saves a lot of overhead for subtransactions that
      are only used for error recovery (eg plpgsql exceptions).  Also, arrange
      to release a subtransaction's XID lock as soon as the subtransaction
      exits, in both the commit and abort cases.  This avoids holding many
      unique locks after a long series of subtransactions.  The price is some
      additional overhead in XactLockTableWait, but that seems acceptable.
      Finally, restructure the state machine in xact.c to have a more orthogonal
      set of states for subtransactions.
      8f9f1986
  22. 29 Aug, 2004 2 commits
  23. 22 Aug, 2004 1 commit
    • Tom Lane's avatar
      Tweak code so that pg_subtrans is never consulted for XIDs older than · f009c316
      Tom Lane authored
      RecentXmin (== MyProc->xmin).  This ensures that it will be safe to
      truncate pg_subtrans at RecentGlobalXmin, which should largely eliminate
      any fear of bloat.  Along the way, eliminate SubTransXidsHaveCommonAncestor,
      which isn't really needed and could not give a trustworthy result anyway
      under the lookback restriction.
      In an unrelated but nearby change, #ifdef out GetUndoRecPtr, which has
      been dead code since 2001 and seems unlikely to ever be resurrected.
      f009c316
  24. 28 Jul, 2004 1 commit
    • Tom Lane's avatar
      Fix subtransaction behavior for large objects, temp namespace, files, · 1bf3d615
      Tom Lane authored
      password/group files.  Also allow read-only subtransactions of a read-write
      parent, but not vice versa.  These are the reasonably noncontroversial
      parts of Alvaro's recent mop-up patch, plus further work on large objects
      to minimize use of the TopTransactionResourceOwner.
      1bf3d615
  25. 27 Jul, 2004 1 commit
  26. 01 Jul, 2004 1 commit
  27. 28 May, 2004 1 commit
    • Tom Lane's avatar
      Code review for EXEC_BACKEND changes. Reduce the number of #ifdefs by · 1a321f26
      Tom Lane authored
      about a third, make it work on non-Windows platforms again.  (But perhaps
      I broke the WIN32 code, since I have no way to test that.)  Fold all the
      paths that fork postmaster child processes to go through the single
      routine SubPostmasterMain, which takes care of resurrecting the state that
      would normally be inherited from the postmaster (including GUC variables).
      Clean up some places where there's no particularly good reason for the
      EXEC and non-EXEC cases to work differently.  Take care of one or two
      FIXMEs that remained in the code.
      1a321f26
  28. 01 Dec, 2003 1 commit
    • Bruce Momjian's avatar
      Try to reduce confusion about what is a lock method identifier, a lock · e7ca8674
      Bruce Momjian authored
      method control structure, or a table of control structures.
      
      . Use type LOCKMASK where an int is not a counter.
      
      . Get rid of INVALID_TABLEID, use INVALID_LOCKMETHOD instead.
      
      . Use INVALID_LOCKMETHOD instead of (LOCKMETHOD) NULL, because
        LOCKMETHOD is not a pointer.
      
      . Define and use macro LockMethodIsValid.
      
      . Rename LOCKMETHOD to LOCKMETHODID.
      
      . Remove global variable LongTermTableId in lmgr.c, because it is
        never used.
      
      . Make LockTableId static in lmgr.c, because it is used nowhere else.
        Why not remove it and use DEFAULT_LOCKMETHOD?
      
      . Rename the lock method control structure from LOCKMETHODTABLE to
        LockMethodData.  Introduce a pointer type named LockMethod.
      
      . Remove elog(FATAL) after InitLockTable() call in
        CreateSharedMemoryAndSemaphores(), because if something goes wrong,
        there is elog(FATAL) in LockMethodTableInit(), and if this doesn't
        help, an elog(ERROR) in InitLockTable() is promoted to FATAL.
      
      . Make InitLockTable() void, because its only caller does not use its
        return value any more.
      
      . Rename variables in lock.c to avoid statements like
              LockMethodTable[NumLockMethods] = lockMethodTable;
              lockMethodTable = LockMethodTable[lockmethod];
      
      . Change LOCKMETHODID type to uint16 to fit into struct LOCKTAG.
      
      . Remove static variables BITS_OFF and BITS_ON from lock.c, because
        I agree to this doubt:
       * XXX is a fetch from a static array really faster than a shift?
      
      . Define and use macros LOCKBIT_ON/OFF.
      
      
      Manfred Koizar
      e7ca8674
  29. 29 Nov, 2003 1 commit
    • PostgreSQL Daemon's avatar
      · 969685ad
      PostgreSQL Daemon authored
      $Header: -> $PostgreSQL Changes ...
      969685ad
  30. 04 Sep, 2003 1 commit
    • Tom Lane's avatar
      Reimplement hash index locking algorithms, per my recent proposal to · 7a369371
      Tom Lane authored
      pghackers.  This fixes the problem recently reported by Markus KrÌutner
      (hash bucket split corrupts the state of scans being done concurrently),
      and I believe it also fixes all the known problems with deadlocks in
      hash index operations.  Hash indexes are still not really ready for prime
      time (since they aren't WAL-logged), but this is a step forward.
      7a369371
  31. 17 Aug, 2003 1 commit
  32. 04 Aug, 2003 1 commit
  33. 24 Jul, 2003 1 commit
  34. 19 Feb, 2003 2 commits
    • Bruce Momjian's avatar
    • Bruce Momjian's avatar
      - Modifies LOCKTAG to include a 'classId'. Relation receive a classId of · d0f3a7e9
      Bruce Momjian authored
      RelOid_pg_class, and transaction locks XactLockTableId. RelId is renamed
      to objId.
      
      - LockObject() and UnlockObject() functions created, and their use
      sprinkled throughout the code to do descent locking for domains and
      types. They accept lock modes AccessShare and AccessExclusive, as we
      only really need a 'read' and 'write' lock at the moment.  Most locking
      cases are held until the end of the transaction.
      
      This fixes the cases Tom mentioned earlier in regards to locking with
      Domains.  If the patch is good, I'll work on cleaning up issues with
      other database objects that have this problem (most of them).
      
      Rod Taylor
      d0f3a7e9
  35. 01 Aug, 2002 1 commit
  36. 20 Jun, 2002 1 commit
  37. 25 Oct, 2001 1 commit