1. 19 12月, 2014 2 次提交
    • 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
    • H
      Change how first WAL segment on new timeline after promotion is created. · ba94518a
      Heikki Linnakangas 提交于
      Two changes:
      
      1. When copying a WAL segment from old timeline to create the first segment
      on the new timeline, only copy up to the point where the timeline switch
      happens, and zero-fill the rest. This avoids corner cases where we might
      think that the copied WAL from the previous timeline belong to the new
      timeline.
      
      2. If the timeline switch happens at a segment boundary, don't copy the
      whole old segment to the new timeline. It's pointless, because it's 100%
      identical to the old segment.
      ba94518a
  2. 18 12月, 2014 13 次提交
    • F
      Add memory barriers for PgBackendStatus.st_changecount protocol. · 38628db8
      Fujii Masao 提交于
      st_changecount protocol needs the memory barriers to ensure that
      the apparent order of execution is as it desires. Otherwise,
      for example, the CPU might rearrange the code so that st_changecount
      is incremented twice before the modification on a machine with
      weak memory ordering. This surprising result can lead to bugs.
      
      This commit introduces the macros to load and store st_changecount
      with the memory barriers. These are called before and after
      PgBackendStatus entries are modified or copied into private memory,
      in order to prevent CPU from reordering PgBackendStatus access.
      
      Per discussion on pgsql-hackers, we decided not to back-patch this
      to 9.4 or before until we get an actual bug report about this.
      
      Patch by me. Review by Robert Haas.
      38628db8
    • F
      Ensure variables live across calls in generate_series(numeric, numeric). · 19e065c0
      Fujii Masao 提交于
      In generate_series_step_numeric(), the variables "start_num"
      and "stop_num" may be potentially freed until the next call.
      So they should be put in the location which can survive across calls.
      But previously they were not, and which could cause incorrect
      behavior of generate_series(numeric, numeric). This commit fixes
      this problem by copying them on multi_call_memory_ctx.
      
      Andrew Gierth
      19e065c0
    • F
      Update .gitignore for config.cache. · ccf292cd
      Fujii Masao 提交于
      Also add a comment about why regreesion.* aren't listed in .gitignore.
      
      Jim Nasby
      ccf292cd
    • A
      Adjust valgrind suppression to the changes in 2c03216d. · 72950dc1
      Andres Freund 提交于
      CRC computation is now done in XLogRecordAssemble.
      72950dc1
    • N
      Recognize Makefile line continuations in fetchRegressOpts(). · 43b56171
      Noah Misch 提交于
      Back-patch to 9.0 (all supported versions).  This is mere
      future-proofing in the context of the master branch, but commit
      f6dc6dd5 requires it of older branches.
      43b56171
    • F
      Remove odd blank line in comment. · 26674c92
      Fujii Masao 提交于
      Etsuro Fujita
      26674c92
    • A
      Fix (re-)starting from a basebackup taken off a standby after a failure. · c303e9e7
      Andres Freund 提交于
      When starting up from a basebackup taken off a standby extra logic has
      to be applied to compute the point where the data directory is
      consistent. Normal base backups use a WAL record for that purpose, but
      that isn't possible on a standby.
      
      That logic had a error check ensuring that the cluster's control file
      indicates being in recovery. Unfortunately that check was too strict,
      disregarding the fact that the control file could also indicate that
      the cluster was shut down while in recovery.
      
      That's possible when the a cluster starting from a basebackup is shut
      down before the backup label has been removed. When everything goes
      well that's a short window, but when either restore_command or
      primary_conninfo isn't configured correctly the window can get much
      wider. That's because inbetween reading and unlinking the label we
      restore the last checkpoint from WAL which can need additional WAL.
      
      To fix simply also allow starting when the control file indicates
      "shutdown in recovery". There's nicer fixes imaginable, but they'd be
      more invasive.
      
      Backpatch to 9.2 where support for taking basebackups from standbys
      was added.
      c303e9e7
    • N
      Fix previous commit for TAP test suites in VPATH builds. · 40c598fa
      Noah Misch 提交于
      Per buildfarm member crake.  Back-patch to 9.4, where the TAP suites
      were introduced.
      40c598fa
    • N
      Lock down regression testing temporary clusters on Windows. · f6dc6dd5
      Noah Misch 提交于
      Use SSPI authentication to allow connections exclusively from the OS
      user that launched the test suite.  This closes on Windows the
      vulnerability that commit be76a6d3
      closed on other platforms.  Users of "make installcheck" or custom test
      harnesses can run "pg_regress --config-auth=DATADIR" to activate the
      same authentication configuration that "make check" would use.
      Back-patch to 9.0 (all supported versions).
      
      Security: CVE-2014-0067
      f6dc6dd5
    • T
      Allow CHECK constraints to be placed on foreign tables. · fc2ac1fb
      Tom Lane 提交于
      As with NOT NULL constraints, we consider that such constraints are merely
      reports of constraints that are being enforced by the remote server (or
      other underlying storage mechanism).  Their only real use is to allow
      planner optimizations, for example in constraint-exclusion checks.  Thus,
      the code changes here amount to little more than removal of the error that
      was formerly thrown for applying CHECK to a foreign table.
      
      (In passing, do a bit of cleanup of the ALTER FOREIGN TABLE reference page,
      which had accumulated some weird decisions about ordering etc.)
      
      Shigeru Hanada and Etsuro Fujita, reviewed by Kyotaro Horiguchi and
      Ashutosh Bapat.
      fc2ac1fb
    • H
      Clarify the regexp used to detect source files in MSVC builds. · ce01548d
      Heikki Linnakangas 提交于
      The old pattern would match files with strange extensions like *.ry or
      *.lpp. Refactor it to only include files with known extensions, and to make
      it more readable.
      
      Per Andrew Dunstan's suggestion.
      ce01548d
    • T
      Fix another poorly worded error message. · c3404942
      Tom Lane 提交于
      Spotted by Álvaro Herrera.
      c3404942
    • T
      Fix poorly worded error message. · c977b8cf
      Tom Lane 提交于
      Adam Brightwell, per report from Martín Marqués.
      c977b8cf
  3. 17 12月, 2014 6 次提交
    • M
      Update .gitignore for pg_upgrade · cef0ae49
      Magnus Hagander 提交于
      Add Windows versions of generated scripts, and make sure we only
      ignore the scripts int he root directory.
      
      Michael Paquier
      cef0ae49
    • M
      Add missing documentation for some vcregress modes · 6964ad95
      Magnus Hagander 提交于
      Michael Paquier
      6964ad95
    • M
      Remove redundant sentence · cb7b5c5c
      Magnus Hagander 提交于
      Spotted by David Johnston
      cb7b5c5c
    • T
      Fix off-by-one loop count in MapArrayTypeName, and get rid of static array. · 66709133
      Tom Lane 提交于
      MapArrayTypeName would copy up to NAMEDATALEN-1 bytes of the base type
      name, which of course is wrong: after prepending '_' there is only room for
      NAMEDATALEN-2 bytes.  Aside from being the wrong result, this case would
      lead to overrunning the statically allocated work buffer.  This would be a
      security bug if the function were ever used outside bootstrap mode, but it
      isn't, at least not in any currently supported branches.
      
      Aside from fixing the off-by-one loop logic, this patch gets rid of the
      static work buffer by having MapArrayTypeName pstrdup its result; the sole
      caller was already doing that, so this just requires moving the pstrdup
      call.  This saves a few bytes but mainly it makes the API a lot cleaner.
      
      Back-patch on the off chance that there is some third-party code using
      MapArrayTypeName with less-secure input.  Pushing pstrdup into the function
      should not cause any serious problems for such hypothetical code; at worst
      there might be a short term memory leak.
      
      Per Coverity scanning.
      66709133
    • T
      Suppress bogus statistics when pgbench failed to complete any transactions. · de8e46f5
      Tom Lane 提交于
      Code added in 9.4 would attempt to divide by zero in such cases.
      Noted while testing fix for missing-pclose problem.
      de8e46f5
    • T
      Fix file descriptor leak after failure of a \setshell command in pgbench. · d38e8d30
      Tom Lane 提交于
      If the called command fails to return data, runShellCommand forgot to
      pclose() the pipe before returning.  This is fairly harmless in the current
      code, because pgbench would then abandon further processing of that client
      thread; so no more than nclients descriptors could be leaked this way.  But
      it's not hard to imagine future improvements whereby that wouldn't be true.
      In any case, it's sloppy coding, so patch all branches.  Found by Coverity.
      d38e8d30
  4. 16 12月, 2014 7 次提交
  5. 15 12月, 2014 5 次提交
  6. 14 12月, 2014 5 次提交
  7. 13 12月, 2014 2 次提交
    • T
      Avoid instability in output of new REINDEX SCHEMA test. · 1c5c70df
      Tom Lane 提交于
      The planner seems to like to do this join query as a hash join, making
      the output ordering machine-dependent; worse, it's a hash on OIDs, so
      that it's a bit astonishing that the result doesn't change from run to
      run even on one machine.  Add an ORDER BY to get consistent results.
      Per buildfarm.
      
      I also suppressed output from the final DROP SCHEMA CASCADE, to avoid
      occasional failures similar to those fixed in commit 81d815dc.
      That hasn't been observed in the buildfarm yet, but it seems likely
      to happen in future if we leave it as-is.
      1c5c70df
    • A
      Add several generator functions for jsonb that exist for json. · 7e354ab9
      Andrew Dunstan 提交于
      The functions are:
          to_jsonb()
          jsonb_object()
          jsonb_build_object()
          jsonb_build_array()
          jsonb_agg()
          jsonb_object_agg()
      
      Also along the way some better logic is implemented in
      json_categorize_type() to match that in the newly implemented
      jsonb_categorize_type().
      
      Andrew Dunstan, reviewed by Pavel Stehule and Alvaro Herrera.
      7e354ab9