1. 30 4月, 2013 1 次提交
  2. 22 3月, 2013 1 次提交
    • S
      Allow I/O reliability checks using 16-bit checksums · 96ef3b8f
      Simon Riggs 提交于
      Checksums are set immediately prior to flush out of shared buffers
      and checked when pages are read in again. Hint bit setting will
      require full page write when block is dirtied, which causes various
      infrastructure changes. Extensive comments, docs and README.
      
      WARNING message thrown if checksum fails on non-all zeroes page;
      ERROR thrown but can be disabled with ignore_checksum_failure = on.
      
      Feature enabled by an initdb option, since transition from option off
      to option on is long and complex and has not yet been implemented.
      Default is not to use checksums.
      
      Checksum used is WAL CRC-32 truncated to 16-bits.
      
      Simon Riggs, Jeff Davis, Greg Smith
      Wide input and assistance from many community members. Thank you.
      96ef3b8f
  3. 01 3月, 2013 1 次提交
  4. 12 2月, 2013 1 次提交
    • A
      Create libpgcommon, and move pg_malloc et al to it · 8396447c
      Alvaro Herrera 提交于
      libpgcommon is a new static library to allow sharing code among the
      various frontend programs and backend; this lets us eliminate duplicate
      implementations of common routines.  We avoid libpgport, because that's
      intended as a place for porting issues; per discussion, it seems better
      to keep them separate.
      
      The first use case, and the only implemented by this patch, is pg_malloc
      and friends, which many frontend programs were already using.
      
      At the same time, we can use this to provide palloc emulation functions
      for the frontend; this way, some palloc-using files in the backend can
      also be used by the frontend cleanly.  To do this, we change palloc() in
      the backend to be a function instead of a macro on top of
      MemoryContextAlloc().  This was previously believed to cause loss of
      performance, but this implementation has been tweaked by Tom and Andres
      so that on modern compilers it provides a slight improvement over the
      previous one.
      
      This lets us clean up some places that were already with
      localized hacks.
      
      Most of the pg_malloc/palloc changes in this patch were authored by
      Andres Freund. Zoltán Böszörményi also independently provided a form of
      that.  libpgcommon infrastructure was authored by Álvaro.
      8396447c
  5. 25 1月, 2013 1 次提交
  6. 23 1月, 2013 1 次提交
    • A
      Improve concurrency of foreign key locking · 0ac5ad51
      Alvaro Herrera 提交于
      This patch introduces two additional lock modes for tuples: "SELECT FOR
      KEY SHARE" and "SELECT FOR NO KEY UPDATE".  These don't block each
      other, in contrast with already existing "SELECT FOR SHARE" and "SELECT
      FOR UPDATE".  UPDATE commands that do not modify the values stored in
      the columns that are part of the key of the tuple now grab a SELECT FOR
      NO KEY UPDATE lock on the tuple, allowing them to proceed concurrently
      with tuple locks of the FOR KEY SHARE variety.
      
      Foreign key triggers now use FOR KEY SHARE instead of FOR SHARE; this
      means the concurrency improvement applies to them, which is the whole
      point of this patch.
      
      The added tuple lock semantics require some rejiggering of the multixact
      module, so that the locking level that each transaction is holding can
      be stored alongside its Xid.  Also, multixacts now need to persist
      across server restarts and crashes, because they can now represent not
      only tuple locks, but also tuple updates.  This means we need more
      careful tracking of lifetime of pg_multixact SLRU files; since they now
      persist longer, we require more infrastructure to figure out when they
      can be removed.  pg_upgrade also needs to be careful to copy
      pg_multixact files over from the old server to the new, or at least part
      of multixact.c state, depending on the versions of the old and new
      servers.
      
      Tuple time qualification rules (HeapTupleSatisfies routines) need to be
      careful not to consider tuples with the "is multi" infomask bit set as
      being only locked; they might need to look up MultiXact values (i.e.
      possibly do pg_multixact I/O) to find out the Xid that updated a tuple,
      whereas they previously were assured to only use information readily
      available from the tuple header.  This is considered acceptable, because
      the extra I/O would involve cases that would previously cause some
      commands to block waiting for concurrent transactions to finish.
      
      Another important change is the fact that locking tuples that have
      previously been updated causes the future versions to be marked as
      locked, too; this is essential for correctness of foreign key checks.
      This causes additional WAL-logging, also (there was previously a single
      WAL record for a locked tuple; now there are as many as updated copies
      of the tuple there exist.)
      
      With all this in place, contention related to tuples being checked by
      foreign key rules should be much reduced.
      
      As a bonus, the old behavior that a subtransaction grabbing a stronger
      tuple lock than the parent (sub)transaction held on a given tuple and
      later aborting caused the weaker lock to be lost, has been fixed.
      
      Many new spec files were added for isolation tester framework, to ensure
      overall behavior is sane.  There's probably room for several more tests.
      
      There were several reviewers of this patch; in particular, Noah Misch
      and Andres Freund spent considerable time in it.  Original idea for the
      patch came from Simon Riggs, after a problem report by Joel Jacobson.
      Most code is from me, with contributions from Marti Raudsepp, Alexander
      Shulgin, Noah Misch and Andres Freund.
      
      This patch was discussed in several pgsql-hackers threads; the most
      important start at the following message-ids:
      	AANLkTimo9XVcEzfiBR-ut3KVNDkjm2Vxh+t8kAmWjPuv@mail.gmail.com
      	1290721684-sup-3951@alvh.no-ip.org
      	1294953201-sup-2099@alvh.no-ip.org
      	1320343602-sup-2290@alvh.no-ip.org
      	1339690386-sup-8927@alvh.no-ip.org
      	4FE5FF020200002500048A3D@gw.wicourts.gov
      	4FEAB90A0200002500048B7D@gw.wicourts.gov
      0ac5ad51
  7. 09 1月, 2013 1 次提交
  8. 03 1月, 2013 1 次提交
  9. 02 1月, 2013 1 次提交
  10. 27 12月, 2012 1 次提交
  11. 21 12月, 2012 1 次提交
    • B
      Avoid using NAMEDATALEN in pg_upgrade · dc9896a2
      Bruce Momjian 提交于
      Because the client encoding might not match the server encoding,
      pg_upgrade can't allocate NAMEDATALEN bytes for storage of database,
      relation, and namespace identifiers.  Instead pg_strdup() the memory and
      free it.
      
      Also add C comment in initdb.c about safe NAMEDATALEN usage.
      dc9896a2
  12. 08 12月, 2012 1 次提交
    • B
      Improve pg_upgrade's status display · 6dd95845
      Bruce Momjian 提交于
      Pg_upgrade displays file names during copy and database names during
      dump/restore.  Andrew Dunstan identified three bugs:
      
      *  long file names were being truncated to 60 _leading_ characters, which
         often do not change for long file names
      
      *  file names were truncated to 60 characters in log files
      
      *  carriage returns were being output to log files
      
      This commit fixes these --- it prints 60 _trailing_ characters to the
      status display, and full path names without carriage returns to log
      files.  It also suppresses status output to the log file unless verbose
      mode is used.
      6dd95845
  13. 01 12月, 2012 1 次提交
  14. 15 11月, 2012 1 次提交
  15. 14 11月, 2012 1 次提交
  16. 05 9月, 2012 1 次提交
  17. 04 9月, 2012 3 次提交
    • A
      0829c708
    • A
      Use correct path separator for Windows builtin commands. · 504aeea6
      Andrew Dunstan 提交于
      pg_upgrade produces a platform-specific script to remove the old
      directory, but on Windows it has not been making sure that the
      paths it writes as arguments for rmdir and del use the backslash
      path separator, which will cause these scripts to fail.
      
      The fix is backpatched to Release 9.0.
      504aeea6
    • T
      Fix pg_upgrade to cope with non-default unix_socket_directory scenarios. · f763b771
      Tom Lane 提交于
      When starting either an old or new postmaster, force it to place its Unix
      socket in the current directory.  This makes it even harder for accidental
      connections to occur during pg_upgrade, and also works around some
      scenarios where the default socket location isn't usable.  (For example,
      if the default location is something other than "/tmp", it might not exist
      during "make check".)
      
      When checking an already-running old postmaster, find out its actual socket
      directory location from postmaster.pid, if possible.  This dodges problems
      with an old postmaster having a configured location different from the
      default built into pg_upgrade's libpq.  We can't find that out if the old
      postmaster is pre-9.1, so also document how to cope with such scenarios
      manually.
      
      In support of this, centralize handling of the connection-related command
      line options passed to pg_upgrade's subsidiary programs, such as pg_dump.
      This should make future changes easier.
      
      Bruce Momjian and Tom Lane
      f763b771
  18. 28 8月, 2012 1 次提交
    • A
      pg_upgrade: Fix exec_prog API to be less flaky · 088c065c
      Alvaro Herrera 提交于
      The previous signature made it very easy to pass something other than
      the printf-format specifier in the corresponding position, without any
      warning from the compiler.
      
      While at it, move some of the escaping, redirecting and quoting
      responsibilities from the callers into exec_prog() itself.  This makes
      the callsites cleaner.
      088c065c
  19. 08 8月, 2012 1 次提交
  20. 26 7月, 2012 1 次提交
  21. 18 7月, 2012 2 次提交
    • T
      Get rid of useless global variable in pg_upgrade. · faf26bf1
      Tom Lane 提交于
      Since the scandir() emulation was taken out of pg_upgrade, there's
      no longer any need for scandir_file_pattern to exist as a global
      variable.  Replace it with a local in the one remaining function
      that was making use of it.
      faf26bf1
    • T
      Improve pg_upgrade's load_directory() function. · 3d6ec663
      Tom Lane 提交于
      Error out on out-of-memory, rather than returning -1, which the sole
      existing caller wasn't checking for anyway.  There doesn't seem to be
      any use-case for making the caller check for failure here.
      
      Detect failure return from readdir().
      
      Use a less platform-dependent method of calculating the entrysize.
      It's possible, but not yet confirmed, that this explains bug #6733,
      in which Mike Wilson reports a pg_upgrade crash that did not occur
      in 9.1.  (Note that load_directory is effectively new code in 9.2,
      at least on platforms that have scandir().)
      
      Fix up comments, avoid uselessly using two counters, reduce the number
      of realloc calls to something sane.
      3d6ec663
  22. 26 6月, 2012 1 次提交
    • H
      Fix pg_upgrade, broken by the xlogid/segno -> 64-bit int refactoring. · 038f3a05
      Heikki Linnakangas 提交于
      The xlogid + segno representation of a particular WAL segment doesn't make
      much sense in pg_resetxlog anymore, now that we don't use that anywhere
      else. Use the WAL filename instead, since that's a convenient way to name a
      particular WAL segment.
      
      I did this partially for pg_resetxlog in the original xlogid/segno -> uint64
      patch, but I neglected pg_upgrade and the docs. This should now be more
      complete.
      038f3a05
  23. 14 6月, 2012 1 次提交
  24. 11 6月, 2012 1 次提交
  25. 25 5月, 2012 2 次提交
  26. 24 5月, 2012 1 次提交
  27. 11 4月, 2012 1 次提交
  28. 17 3月, 2012 2 次提交
  29. 13 3月, 2012 1 次提交
    • B
      In pg_upgrade, add various logging improvements: · 717f6d60
      Bruce Momjian 提交于
      	add ability to control permissions of created files
      	have psql echo its queries for easier debugging
      	output four separate log files, and delete them on success
      	add -r/--retain option to keep log files after success
      	make logs file append-only
      	remove -g/-G/-l logging options
      	sugggest tailing appropriate log file on failure
      	enhance -v/--verbose behavior
      717f6d60
  30. 06 3月, 2012 1 次提交
  31. 02 1月, 2012 1 次提交
  32. 18 11月, 2011 2 次提交
  33. 10 10月, 2011 1 次提交
  34. 08 10月, 2011 1 次提交