1. 29 12月, 2014 1 次提交
  2. 27 12月, 2014 3 次提交
    • A
      Restrict name list len for domain constraints · 6630420f
      Alvaro Herrera 提交于
      This avoids an ugly-looking "cache lookup failure" message.
      
      Ugliness pointed out by Andres Freund.
      6630420f
    • A
      Remove event trigger from object_address test · 289121a4
      Alvaro Herrera 提交于
      It is causing trouble when run in parallel mode, because dropping the
      function other sessions are running concurrently causes them to fail due
      to inability to find the function.
      
      Per buildfarm, as noted by Tom Lane.
      289121a4
    • A
      Grab heavyweight tuple lock only before sleeping · 0e5680f4
      Alvaro Herrera 提交于
      We were trying to acquire the lock even when we were subsequently
      not sleeping in some other transaction, which opens us up unnecessarily
      to deadlocks.  In particular, this is troublesome if an update tries to
      lock an updated version of a tuple and finds itself doing EvalPlanQual
      update chain walking; more than two sessions doing this concurrently
      will find themselves sleeping on each other because the HW tuple lock
      acquisition in heap_lock_tuple called from EvalPlanQualFetch races with
      the same tuple lock being acquired in heap_update -- one of these
      sessions sleeps on the other one to finish while holding the tuple lock,
      and the other one sleeps on the tuple lock.
      
      Per trouble report from Andrew Sackville-West in
      http://www.postgresql.org/message-id/20140731233051.GN17765@andrew-ThinkPad-X230
      
      His scenario can be simplified down to a relatively simple
      isolationtester spec file which I don't include in this commit; the
      reason is that the current isolationtester is not able to deal with more
      than one blocked session concurrently and it blocks instead of raising
      the expected deadlock.  In the future, if we improve isolationtester, it
      would be good to include the spec file in the isolation schedule.  I
      posted it in
      http://www.postgresql.org/message-id/20141212205254.GC1768@alvh.no-ip.org
      
      Hat tip to Mark Kirkwood, who helped diagnose the trouble.
      0e5680f4
  3. 26 12月, 2014 7 次提交
    • N
      Have config_sspi_auth() permit IPv6 localhost connections. · 8d9cb0bc
      Noah Misch 提交于
      Windows versions later than Windows Server 2003 map "localhost" to ::1.
      Account for that in the generated pg_hba.conf, fixing another oversight
      in commit f6dc6dd5.  Back-patch to 9.0,
      like that commit.
      
      David Rowley and Noah Misch
      8d9cb0bc
    • A
      Blindly fix a dtrace probe in lwlock.c for a removed local variable. · 740a4ec7
      Andres Freund 提交于
      Per buildfarm member locust.
      740a4ec7
    • T
      Temporarily revert "Move pg_lzcompress.c to src/common." · 966115c3
      Tom Lane 提交于
      This reverts commit 60838df9.
      That change needs a bit more thought to be workable.  In view of
      the potentially machine-dependent stuff that went in today,
      we need all of the buildfarm to be testing those other changes.
      966115c3
    • A
      Lockless StrategyGetBuffer clock sweep hot path. · d72731a7
      Andres Freund 提交于
      StrategyGetBuffer() has proven to be a bottleneck in a number of
      buffer acquisition heavy workloads. To some degree this has already
      been alleviated by 5d7962c6, but it still can be quite a heavy
      bottleneck.  The problem is that in unfortunate usage patterns a
      single StrategyGetBuffer() call will have to look at a large number of
      buffers - in turn making it likely that the process will be put to
      sleep while still holding the spinlock.
      
      Replace most of the usage of the buffer_strategy_lock spinlock for the
      clock sweep by a atomic nextVictimBuffer variable. That variable,
      modulo NBuffers, is the current hand of the clock sweep. The buffer
      clock-sweep then only needs to acquire the spinlock after a
      wraparound. And even then only in the process that did the wrapping
      around. That alleviates nearly all the contention on the relevant
      spinlock, although significant contention on the cacheline can still
      exist.
      
      Reviewed-By: Robert Haas and Amit Kapila
      
      Discussion: 20141010160020.GG6670@alap3.anarazel.de,
          20141027133218.GA2639@awork2.anarazel.de
      d72731a7
    • A
      Improve LWLock scalability. · ab5194e6
      Andres Freund 提交于
      The old LWLock implementation had the problem that concurrent lock
      acquisitions required exclusively acquiring a spinlock. Often that
      could lead to acquirers waiting behind the spinlock, even if the
      actual LWLock was free.
      
      The new implementation doesn't acquire the spinlock when acquiring the
      lock itself. Instead the new atomic operations are used to atomically
      manipulate the state. Only the waitqueue, used solely in the slow
      path, is still protected by the spinlock. Check lwlock.c's header for
      an explanation about the used algorithm.
      
      For some common workloads on larger machines this can yield
      significant performance improvements. Particularly in read mostly
      workloads.
      
      Reviewed-By: Amit Kapila and Robert Haas
      Author: Andres Freund
      
      Discussion: 20130926225545.GB26663@awork2.anarazel.de
      ab5194e6
    • A
      Convert the PGPROC->lwWaitLink list into a dlist instead of open coding it. · 7882c3b0
      Andres Freund 提交于
      Besides being shorter and much easier to read it changes the logic in
      LWLockRelease() to release all shared lockers when waking up any. This
      can yield some significant performance improvements - and the fairness
      isn't really much worse than before, as we always allowed new shared
      lockers to jump the queue.
      7882c3b0
    • A
      Add capability to suppress CONTEXT: messages to elog machinery. · 570bd2b3
      Andres Freund 提交于
      Hiding context messages usually is not a good idea - except for rather
      verbose debugging/development utensils like LOG_DEBUG. There the
      amount of repeated context messages just bloat the log without adding
      information.
      570bd2b3
  4. 25 12月, 2014 3 次提交
    • F
      Remove duplicate include of slot.h. · 4a559319
      Fujii Masao 提交于
      Back-patch to 9.4, where this problem was added.
      4a559319
    • F
      Move pg_lzcompress.c to src/common. · 60838df9
      Fujii Masao 提交于
      Exposing compression and decompression APIs of pglz makes possible its
      use by extensions and contrib modules. pglz_decompress contained a call
      to elog to emit an error message in case of corrupted data. This function
      is changed to return a status code to let its callers return an error instead.
      
      This commit is required for upcoming WAL compression feature so that
      the WAL reader facility can decompress the WAL data by using pglz_decompress.
      
      Michael Paquier
      60838df9
    • T
      Add CST (China Standard Time) to our lists of timezone abbreviations. · 5b89473d
      Tom Lane 提交于
      For some reason this seems to have been missed when the lists in
      src/timezone/tznames/ were first constructed.  We can't put it in Default
      because of the conflict with US CST, but we should certainly list it among
      the alternative entries in Asia.txt.  (I checked for other oversights, but
      all the other abbreviations that are in current use according to the IANA
      files seem to be accounted for.)  Noted while responding to bug #12326.
      5b89473d
  5. 24 12月, 2014 7 次提交
  6. 23 12月, 2014 5 次提交
    • A
      Use a bitmask to represent role attributes · 1826987a
      Alvaro Herrera 提交于
      The previous representation using a boolean column for each attribute
      would not scale as well as we want to add further attributes.
      
      Extra auxilliary functions are added to go along with this change, to
      make up for the lost convenience of access of the old representation.
      
      Catalog version bumped due to change in catalogs and the new functions.
      
      Author: Adam Brightwell, minor tweaks by Álvaro
      Reviewed by: Stephen Frost, Andres Freund, Álvaro Herrera
      1826987a
    • A
      get_object_address: separate domain constraints from table constraints · 7eca575d
      Alvaro Herrera 提交于
      Apart from enabling comments on domain constraints, this enables a
      future project to replicate object dropping to remote servers: with the
      current mechanism there's no way to distinguish between the two types of
      constraints, so there's no way to know what to drop.
      
      Also added support for the domain constraint comments in psql's \dd and
      pg_dump.
      
      Catalog version bumped due to the change in ObjectType enum.
      7eca575d
    • P
      Change local_preload_libraries to PGC_USERSET · 584e35d1
      Peter Eisentraut 提交于
      This allows it to be used with ALTER ROLE SET.
      
      Although the old setting of PGC_BACKEND prevented changes after session
      start, after discussion it was more useful to allow ALTER ROLE SET
      instead and just document that changes during a session have no effect.
      This is similar to how session_preload_libraries works already.
      
      An alternative would be to change things to allow PGC_BACKEND and
      PGC_SU_BACKEND settings to be changed by ALTER ROLE SET.  But that might
      need further research (e.g., log_connections would probably not work).
      
      based on patch by Kyotaro Horiguchi
      584e35d1
    • A
      Further tidy up on json aggregate documentation · 2a3f2743
      Andrew Dunstan 提交于
      2a3f2743
    • A
      Fix documentation of argument type of json_agg and jsonb_agg · b2d145bf
      Andrew Dunstan 提交于
      json_agg was originally designed to aggregate records. However, it soon
      became clear that it is useful for aggregating all kinds of values and
      that's what we have on 9.3 and 9.4, and in head for it and jsonb_agg.
      The documentation suggested otherwise, so this fixes it.
      b2d145bf
  7. 22 12月, 2014 5 次提交
  8. 20 12月, 2014 2 次提交
    • B
      doc: Adjust wording of ALTER TABLESPACE restriction · cfb64fde
      Bruce Momjian 提交于
      Report by Noah Misch
      cfb64fde
    • A
      pg_event_trigger_dropped_objects: add behavior flags · 0ee98d1c
      Alvaro Herrera 提交于
      Add "normal" and "original" flags as output columns to the
      pg_event_trigger_dropped_objects() function.  With this it's possible to
      distinguish which objects, among those listed, need to be explicitely
      referenced when trying to replicate a deletion.
      
      This is necessary so that the list of objects can be pruned to the
      minimum necessary to replicate the DROP command in a remote server that
      might have slightly different schema (for instance, TOAST tables and
      constraints with different names and such.)
      
      Catalog version bumped due to change of function definition.
      
      Reviewed by: Abhijit Menon-Sen, Stephen Frost, Heikki Linnakangas,
      Robert Haas.
      0ee98d1c
  9. 19 12月, 2014 7 次提交
    • H
      Fix timestamp in end-of-recovery WAL records. · 5c805d0a
      Heikki Linnakangas 提交于
      We used time(null) to set a TimestampTz field, which gave bogus results.
      Noticed while looking at pg_xlogdump output.
      
      Backpatch to 9.3 and above, where the fast promotion was introduced.
      5c805d0a
    • A
      Prevent potentially hazardous compiler/cpu reordering during lwlock release. · 37de8de9
      Andres Freund 提交于
      In LWLockRelease() (and in 9.4+ LWLockUpdateVar()) we release enqueued
      waiters using PGSemaphoreUnlock(). As there are other sources of such
      unlocks backends only wake up if MyProc->lwWaiting is set to false;
      which is only done in the aforementioned functions.
      
      Before this commit there were dangers because the store to lwWaitLink
      could become visible before the store to lwWaitLink. This could both
      happen due to compiler reordering (on most compilers) and on some
      platforms due to the CPU reordering stores.
      
      The possible consequence of this is that a backend stops waiting
      before lwWaitLink is set to NULL. If that backend then tries to
      acquire another lock and has to wait there the list could become
      corrupted once the lwWaitLink store is finally performed.
      
      Add a write memory barrier to prevent that issue.
      
      Unfortunately the barrier support has been only added in 9.2. Given
      that the issue has not knowingly been observed in praxis it seems
      sufficient to prohibit compiler reordering using volatile for 9.0 and
      9.1. Actual problems due to compiler reordering are more likely
      anyway.
      
      Discussion: 20140210134625.GA15246@awork2.anarazel.de
      37de8de9
    • A
      Define Assert() et al to ((void)0) to avoid pedantic warnings. · 9959abb0
      Andres Freund 提交于
      gcc's -Wempty-body warns about the current usage when compiling
      postgres without --enable-cassert.
      9959abb0
    • T
      Improve documentation about CASE and constant subexpressions. · 5b516835
      Tom Lane 提交于
      The possibility that constant subexpressions of a CASE might be evaluated
      at planning time was touched on in 9.17.1 (CASE expressions), but it really
      ought to be explained in 4.2.14 (Expression Evaluation Rules) which is the
      primary discussion of such topics.  Add text and an example there, and
      revise the <note> under CASE to link there.
      
      Back-patch to all supported branches, since it's acted like this for a
      long time (though 9.2+ is probably worse because of its more aggressive
      use of constant-folding via replanning of nominally-prepared statements).
      Pre-9.4, also back-patch text added in commit 0ce627d4 about CASE versus
      aggregate functions.
      
      Tom Lane and David Johnston, per discussion of bug #12273.
      5b516835
    • A
      Use %u to print out BlockNumber variables · cd6e6657
      Alvaro Herrera 提交于
      Per Tom Lane
      cd6e6657
    • A
      Have VACUUM log number of skipped pages due to pins · 35192f06
      Alvaro Herrera 提交于
      Author: Jim Nasby, some kibitzing by Heikki Linnankangas.
      Discussion leading to current behavior and precise wording fueled by
      thoughts from Robert Haas and Andres Freund.
      35192f06
    • T
      Improve hash_create's API for selecting simple-binary-key hash functions. · 4a14f13a
      Tom Lane 提交于
      Previously, if you wanted anything besides C-string hash keys, you had to
      specify a custom hashing function to hash_create().  Nearly all such
      callers were specifying tag_hash or oid_hash; which is tedious, and rather
      error-prone, since a caller could easily miss the opportunity to optimize
      by using hash_uint32 when appropriate.  Replace this with a design whereby
      callers using simple binary-data keys just specify HASH_BLOBS and don't
      need to mess with specific support functions.  hash_create() itself will
      take care of optimizing when the key size is four bytes.
      
      This nets out saving a few hundred bytes of code space, and offers
      a measurable performance improvement in tidbitmap.c (which was not
      exploiting the opportunity to use hash_uint32 for its 4-byte keys).
      There might be some wins elsewhere too, I didn't analyze closely.
      
      In future we could look into offering a similar optimized hashing function
      for 8-byte keys.  Under this design that could be done in a centralized
      and machine-independent fashion, whereas getting it right for keys of
      platform-dependent sizes would've been notationally painful before.
      
      For the moment, the old way still works fine, so as not to break source
      code compatibility for loadable modules.  Eventually we might want to
      remove tag_hash and friends from the exported API altogether, since there's
      no real need for them to be explicitly referenced from outside dynahash.c.
      
      Teodor Sigaev and Tom Lane
      4a14f13a