1. 02 12月, 2012 6 次提交
    • S
      Clarify operation of online checkpoints. · 9f98704b
      Simon Riggs 提交于
      Previous comments left, but were too obscure
      for such an important aspect of the system.
      9f98704b
    • T
      Fix psql crash while parsing SQL file whose encoding is different from · 53edb8dc
      Tatsuo Ishii 提交于
      client encoding and the client encoding is not *safe* one. Such an
      example is, file encoding is UTF-8 and client encoding SJIS. Patch
      contributed by Jiang Guiqing.
      53edb8dc
    • T
      Prevent passing gmake's environment variables down through pg_regress. · c35fea10
      Tom Lane 提交于
      When we do "make install" to create a temp installation, we don't want
      that instance of make to try to communicate with any instance of make
      that might be calling us.  This is known to cause problems if the
      upper make has a -jN flag, and in principle could cause problems even
      without that.  Unset the relevant environment variables to prevent such
      issues.
      
      Andres Freund
      c35fea10
    • T
      Make sure sharedir/extension/ directory is created when needed. · b1346822
      Tom Lane 提交于
      The previous coding worked as long as MODULEDIR wasn't set explicitly,
      because we create sharedir/$(datamoduledir) and the default value of
      that is "extension".  But if some other value is specified for MODULEDIR
      then the installation directory needed for the control file wasn't made.
      
      Cédric Villemain
      b1346822
    • T
      Allow adding values to an enum type created in the current transaction. · 7b90469b
      Tom Lane 提交于
      Normally it is unsafe to allow ALTER TYPE ADD VALUE in a transaction block,
      because instances of the value could be added to indexes later in the same
      transaction, and then they would still be accessible even if the
      transaction rolls back.  However, we can allow this if the enum type itself
      was created in the current transaction, because then any such indexes would
      have to go away entirely on rollback.
      
      The reason for allowing this is to support pg_upgrade's new usage of
      pg_restore --single-transaction: in --binary-upgrade mode, pg_dump emits
      enum types as a succession of ALTER TYPE ADD VALUE commands so that it can
      preserve the values' OIDs.  The support is a bit limited, so we'll leave
      it undocumented.
      
      Andres Freund
      7b90469b
    • B
      In pg_upgrade, remove 'set -x' from test script. · 452739df
      Bruce Momjian 提交于
      452739df
  2. 01 12月, 2012 13 次提交
  3. 30 11月, 2012 7 次提交
    • A
      Clean environment for pg_upgrade test. · abece8af
      Andrew Dunstan 提交于
      This removes exisiting PG settings from the environment for
      pg_upgrade tests, just like pg_regress does.
      abece8af
    • M
      Add libpq function PQconninfo() · 65c3bf19
      Magnus Hagander 提交于
      This allows a caller to get back the exact conninfo array that was
      used to create a connection, including parameters read from the
      environment.
      
      In doing this, restructure how options are copied from the conninfo
      to the actual connection.
      
      Zoltan Boszormenyi and Magnus Hagander
      65c3bf19
    • T
      Produce a more useful error message for over-length Unix socket paths. · 4af446e7
      Tom Lane 提交于
      The length of a socket path name is constrained by the size of struct
      sockaddr_un, and there's not a lot we can do about it since that is a
      kernel API.  However, it would be a good thing if we produced an
      intelligible error message when the user specifies a socket path that's too
      long --- and getaddrinfo's standard API is too impoverished to do this in
      the natural way.  So insert explicit tests at the places where we construct
      a socket path name.  Now you'll get an error that makes sense and even
      tells you what the limit is, rather than something generic like
      "Non-recoverable failure in name resolution".
      
      Per trouble report from Jeremy Drake and a fix idea from Andrew Dunstan.
      4af446e7
    • S
      Correctly init fast path fields on PGPROC · d3fe5993
      Simon Riggs 提交于
      d3fe5993
    • S
      Cleanup VirtualXact at end of Hot Standby. · f1e57a4e
      Simon Riggs 提交于
      f1e57a4e
    • R
      Basic binary heap implementation. · 7a2fe9bd
      Robert Haas 提交于
      There are probably other places where this can be used, but for now,
      this just makes MergeAppend use it, so that this code will have test
      coverage.  There is other work in the queue that will use this, as
      well.
      
      Abhijit Menon-Sen, reviewed by Andres Freund, Robert Haas, Álvaro
      Herrera, Tom Lane, and others.
      7a2fe9bd
    • M
      When processing nested structure pointer variables ecpg always expected an · 086cf145
      Michael Meskes 提交于
      array datatype which of course is wrong.
      
      Applied patch by Muhammad Usama <m.usama@gmail.com> to fix this.
      086cf145
  4. 29 11月, 2012 3 次提交
    • T
      Suppress parallel build in interfaces/ecpg/preproc/. · 1fc698cf
      Tom Lane 提交于
      This is to see if it will stop intermittent build failures on buildfarm
      member okapi.  We know that gmake 3.82 has some problems with sometimes
      not honoring dependencies in parallel builds, and it seems likely that
      this is more of the same.  Since the vast bulk of the work in the preproc
      directory is associated with creating preproc.c and then preproc.o,
      parallelism buys us hardly anything here anyway.
      
      Also, make both this .NOTPARALLEL and the one previously added in
      interfaces/ecpg/Makefile be conditional on "ifeq ($(MAKE_VERSION),3.82)".
      The known bug in gmake is fixed upstream and should not be present in
      3.83 and up, and there's no reason to think it affects older releases.
      1fc698cf
    • T
      Fix assorted bugs in CREATE/DROP INDEX CONCURRENTLY. · 3c840464
      Tom Lane 提交于
      Commit 8cb53654, which introduced DROP
      INDEX CONCURRENTLY, managed to break CREATE INDEX CONCURRENTLY via a poor
      choice of catalog state representation.  The pg_index state for an index
      that's reached the final pre-drop stage was the same as the state for an
      index just created by CREATE INDEX CONCURRENTLY.  This meant that the
      (necessary) change to make RelationGetIndexList ignore about-to-die indexes
      also made it ignore freshly-created indexes; which is catastrophic because
      the latter do need to be considered in HOT-safety decisions.  Failure to
      do so leads to incorrect index entries and subsequently wrong results from
      queries depending on the concurrently-created index.
      
      To fix, add an additional boolean column "indislive" to pg_index, so that
      the freshly-created and about-to-die states can be distinguished.  (This
      change obviously is only possible in HEAD.  This patch will need to be
      back-patched, but in 9.2 we'll use a kluge consisting of overloading the
      formerly-impossible state of indisvalid = true and indisready = false.)
      
      In addition, change CREATE/DROP INDEX CONCURRENTLY so that the pg_index
      flag changes they make without exclusive lock on the index are made via
      heap_inplace_update() rather than a normal transactional update.  The
      latter is not very safe because moving the pg_index tuple could result in
      concurrent SnapshotNow scans finding it twice or not at all, thus possibly
      resulting in index corruption.  This is a pre-existing bug in CREATE INDEX
      CONCURRENTLY, which was copied into the DROP code.
      
      In addition, fix various places in the code that ought to check to make
      sure that the indexes they are manipulating are valid and/or ready as
      appropriate.  These represent bugs that have existed since 8.2, since
      a failed CREATE INDEX CONCURRENTLY could leave a corrupt or invalid
      index behind, and we ought not try to do anything that might fail with
      such an index.
      
      Also fix RelationReloadIndexInfo to ensure it copies all the pg_index
      columns that are allowed to change after initial creation.  Previously we
      could have been left with stale values of some fields in an index relcache
      entry.  It's not clear whether this actually had any user-visible
      consequences, but it's at least a bug waiting to happen.
      
      In addition, do some code and docs review for DROP INDEX CONCURRENTLY;
      some cosmetic code cleanup but mostly addition and revision of comments.
      
      This will need to be back-patched, but in a noticeably different form,
      so I'm committing it to HEAD before working on the back-patch.
      
      Problem reported by Amit Kapila, diagnosis by Pavan Deolassee,
      fix by Tom Lane and Andres Freund.
      3c840464
    • A
      Split out rmgr rm_desc functions into their own files · 1577b46b
      Alvaro Herrera 提交于
      This is necessary (but not sufficient) to have them compilable outside
      of a backend environment.
      1577b46b
  5. 28 11月, 2012 1 次提交
  6. 27 11月, 2012 4 次提交
    • T
      Add explicit casts in ilist.h's inline functions. · e78d288c
      Tom Lane 提交于
      Needed to silence C++ errors, per report from Peter Eisentraut.
      
      Andres Freund
      e78d288c
    • H
      Add OpenTransientFile, with automatic cleanup at end-of-xact. · 1f67078e
      Heikki Linnakangas 提交于
      Files opened with BasicOpenFile or PathNameOpenFile are not automatically
      cleaned up on error. That puts unnecessary burden on callers that only want
      to keep the file open for a short time. There is AllocateFile, but that
      returns a buffered FILE * stream, which in many cases is not the nicest API
      to work with. So add function called OpenTransientFile, which returns a
      unbuffered fd that's cleaned up like the FILE* returned by AllocateFile().
      
      This plugs a few rare fd leaks in error cases:
      
      1. copy_file() - fixed by by using OpenTransientFile instead of BasicOpenFile
      2. XLogFileInit() - fixed by adding close() calls to the error cases. Can't
         use OpenTransientFile here because the fd is supposed to persist over
         transaction boundaries.
      3. lo_import/lo_export - fixed by using OpenTransientFile instead of
         PathNameOpenFile.
      
      In addition to plugging those leaks, this replaces many BasicOpenFile() calls
      with OpenTransientFile() that were not leaking, because the code meticulously
      closed the file on error. That wasn't strictly necessary, but IMHO it's good
      for robustness.
      
      The same leaks exist in older versions, but given the rarity of the issues,
      I'm not backpatching this. Not yet, anyway - it might be good to backpatch
      later, after this mechanism has had some more testing in master branch.
      1f67078e
    • T
      Revert patch for taking fewer snapshots. · 53299429
      Tom Lane 提交于
      This reverts commit d573e239, "Take fewer
      snapshots".  While that seemed like a good idea at the time, it caused
      execution to use a snapshot that had been acquired before locking any of
      the tables mentioned in the query.  This created user-visible anomalies
      that were not present in any prior release of Postgres, as reported by
      Tomas Vondra.  While this whole area could do with a redesign (since there
      are related cases that have anomalies anyway), it doesn't seem likely that
      any future patch would be reasonably back-patchable; and we don't want 9.2
      to exhibit a behavior that's subtly unlike either past or future releases.
      Hence, revert to prior code while we rethink the problem.
      53299429
    • T
      Fix SELECT DISTINCT with index-optimized MIN/MAX on inheritance trees. · d3237e04
      Tom Lane 提交于
      In a query such as "SELECT DISTINCT min(x) FROM tab", the DISTINCT is
      pretty useless (there being only one output row), but nonetheless it
      shouldn't fail.  But it could fail if "tab" is an inheritance parent,
      because planagg.c's code for fixing up equivalence classes after making the
      index-optimized MIN/MAX transformation wasn't prepared to find child-table
      versions of the aggregate expression.  The least ugly fix seems to be
      to add an option to mutate_eclass_expressions() to skip child-table
      equivalence class members, which aren't used anymore at this stage of
      planning so it's not really necessary to fix them.  Since child members
      are ignored in many cases already, it seems plausible for
      mutate_eclass_expressions() to have an option to ignore them too.
      
      Per bug #7703 from Maxim Boguk.
      
      Back-patch to 9.1.  Although the same code exists before that, it cannot
      encounter child-table aggregates AFAICS, because the index optimization
      transformation cannot succeed on inheritance trees before 9.1 (for lack
      of MergeAppend).
      d3237e04
  7. 25 11月, 2012 2 次提交
  8. 24 11月, 2012 1 次提交
  9. 23 11月, 2012 2 次提交
  10. 22 11月, 2012 1 次提交
    • H
      Avoid bogus "out-of-sequence timeline ID" errors in standby-mode. · 24c19e6b
      Heikki Linnakangas 提交于
      When startup process opens a WAL segment after replaying part of it, it
      validates the first page on the WAL segment, even though the page it's
      really interested in later in the file. As part of the validation, it checks
      that the TLI on the page header is >= the TLI it saw on the last page it
      read. If the segment contains a timeline switch, and we have already
      replayed it, and then re-open the WAL segment (because of streaming
      replication got disconnected and reconnected, for example), the TLI check
      will fail when the first page is validated. Fix that by relaxing the TLI
      check when re-opening a WAL segment.
      
      Backpatch to 9.0. Earlier versions had the same code, but before standby
      mode was introduced in 9.0, recovery never tried to re-read a segment after
      partially replaying it.
      
      Reported by Amit Kapila, while testing a new feature.
      24c19e6b