1. 04 Apr, 2018 8 commits
    • Teodor Sigaev's avatar
      Skip full index scan during cleanup of B-tree indexes when possible · 857f9c36
      Teodor Sigaev authored
      Vacuum of index consists from two stages: multiple (zero of more) ambulkdelete
      calls and one amvacuumcleanup call. When workload on particular table
      is append-only, then autovacuum isn't intended to touch this table. However,
      user may run vacuum manually in order to fill visibility map and get benefits
      of index-only scans. Then ambulkdelete wouldn't be called for indexes
      of such table (because no heap tuples were deleted), only amvacuumcleanup would
      be called In this case, amvacuumcleanup would perform full index scan for
      two objectives: put recyclable pages into free space map and update index
      statistics.
      
      This patch allows btvacuumclanup to skip full index scan when two conditions
      are satisfied: no pages are going to be put into free space map and index
      statistics isn't stalled. In order to check first condition, we store
      oldest btpo_xact in the meta-page. When it's precedes RecentGlobalXmin, then
      there are some recyclable pages. In order to check second condition we store
      number of heap tuples observed during previous full index scan by cleanup.
      If fraction of newly inserted tuples is less than
      vacuum_cleanup_index_scale_factor, then statistics isn't considered to be
      stalled. vacuum_cleanup_index_scale_factor can be defined as both reloption and GUC (default).
      
      This patch bumps B-tree meta-page version. Upgrade of meta-page is performed
      "on the fly": during VACUUM meta-page is rewritten with new version. No special
      handling in pg_upgrade is required.
      
      Author: Masahiko Sawada, Alexander Korotkov
      Review by: Peter Geoghegan, Kyotaro Horiguchi, Alexander Korotkov, Yura Sokolov
      Discussion: https://www.postgresql.org/message-id/flat/CAD21AoAX+d2oD_nrd9O2YkpzHaFr=uQeGr9s1rKC3O4ENc568g@mail.gmail.com
      857f9c36
    • Tom Lane's avatar
      Remove less-portable-than-believed test case. · eac93e20
      Tom Lane authored
      In commit 331b2369 I added a test to see what jsonb_plperl would do
      with a qr{} result.  Turns out the answer is Perl version dependent.
      That fact doesn't bother me particularly, but coping with multiple
      result possibilities is way more work than this test seems worth.
      So remove it again.
      
      Discussion: https://postgr.es/m/E1f3MMJ-0006bf-B0@gemulon.postgresql.org
      eac93e20
    • Tom Lane's avatar
      Fix platform and Perl-version dependencies in new jsonb_plperl code. · 331b2369
      Tom Lane authored
      Testing SvTYPE() directly is more fraught with problems than one might
      think, because depending on context Perl might be storing a scalar value
      in one of several forms, eg both numeric and string values.  This resulted
      in Perl-version-dependent buildfarm test failures.  Instead use the SvTYPE
      test only to distinguish non-scalar cases (AV, HV, NULL).  Disambiguate
      scalars by testing SvIOK, SvNOK, then SvPOK.  This creates a preference
      order for how we will resolve cases where the value is available in more
      than one form, which seems fine to me.
      
      Furthermore, because we're now dealing directly with a "double" value
      in the SvNOK case, we can get rid of an inadequate and unportable
      string-comparison test for infinities, and use isinf() instead.
      (We do need some additional #include and "-lm" infrastructure to use
      that in a contrib module, per prior experiences.)
      
      In passing, prevent the regression test results from depending on DROP
      CASCADE order; I've not seen that malfunction, but it's trouble waiting
      to happen.
      
      Discussion: https://postgr.es/m/E1f3MMJ-0006bf-B0@gemulon.postgresql.org
      331b2369
    • Heikki Linnakangas's avatar
      Fix the new ARMv8 CRC code for short and unaligned input. · 3a5e0a91
      Heikki Linnakangas authored
      The code before the main loop, to handle the possible 1-7 unaligned bytes
      at the beginning of the input, was broken, and read past the input, if the
      the input was very short.
      3a5e0a91
    • Magnus Hagander's avatar
      Fix pg_bsaebackup checksum tests · ee9e1455
      Magnus Hagander authored
      Hopefully fix the fact that these checks are unstable, by introducing
      the corruption in a separate table from pg_class, and also explicitly
      disable autovacuum on those tables. Also make sure PostgreSQL is
      stopped while the corruption is introduced to avoid possible caching
      effects.
      
      Author: Michael Banck
      ee9e1455
    • Heikki Linnakangas's avatar
      Use ARMv8 CRC instructions where available. · f044d71e
      Heikki Linnakangas authored
      ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
      them, when available, for speed.
      
      Like with the similar Intel CRC instructions, several factors affect
      whether the instructions can be used. The compiler intrinsics for them must
      be supported by the compiler, and the instructions must be supported by the
      target architecture. If the compilation target architecture does not
      support the instructions, but adding "-march=armv8-a+crc" makes them
      available, then we compile the code with a runtime check to determine if
      the host we're running on supports them or not.
      
      For the runtime check, use glibc getauxval() function. Unfortunately,
      that's not very portable, but I couldn't find any more portable way to do
      it. If getauxval() is not available, the CRC instructions will still be
      used if the target architecture supports them without any additional
      compiler flags, but the runtime check will not be available.
      
      Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
      Freund, Thomas Munro.
      
      Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
      f044d71e
    • Heikki Linnakangas's avatar
      Also fix the descriptions in pg_config.h.win32. · 638a199f
      Heikki Linnakangas authored
      I missed pg_config.h.win32 in the previous commit that fixed these in
      pg_config.h.in.
      638a199f
    • Heikki Linnakangas's avatar
      Fix incorrect description of USE_SLICING_BY_8_CRC32C. · 8989f52b
      Heikki Linnakangas authored
      And a typo in the description of USE_SSE42_CRC32C_WITH_RUNTIME_CHECK,
      spotted by Daniel Gustafsson.
      8989f52b
  2. 03 Apr, 2018 16 commits
    • Alvaro Herrera's avatar
      Don't clone internal triggers to partitions · 851f4b4e
      Alvaro Herrera authored
      Trigger cloning to partitions was supposed to occur for user-visible
      triggers only, but during development the protection that prevented it
      from occurring to internal triggers was lost.  Reinstate it, as well as
      add a test case to ensure internal triggers (in the tested case,
      triggers implementing a deferred unique constraint) are not cloned.
      Without the code fix, the partitions in the test end up with different
      numbers of triggers, which is clearly wrong ...
      
      Bug in 86f57594.
      
      Discussion: https://postgr.es/m/20180403214903.ozfagwjcpk337uw7@alvherre.pgsql
      851f4b4e
    • Andres Freund's avatar
      Fix GCC 7 snprintf() compiler warning. · 2b303155
      Andres Freund authored
      Make buffer 1 byte larger to fit a sign.  It's actually impossible for
      there to be a sign in practice, but this is still required to keep GCC 7
      happy.
      
      Cleanup from commit 51bc2717.
      
      Based on a suggestion from Peter Eisentraut.
      
      Author: Peter Geoghegan
      Reported-By: Peter Eisentraut
      Discussion: https://postgr.es/m/d1cc82ed-d07d-cef2-7c00-2e987f121648@2ndquadrant.com
      2b303155
    • Alvaro Herrera's avatar
      Pass correct TupDesc to ri_NullCheck() in Assert · cd5005bc
      Alvaro Herrera authored
      Previous coding was passing the wrong table's tuple descriptor, which
      accidentally fails to fail because no existing test case exercises a
      foreign key in which the referenced attributes are further to the right
      of the referencing attributes.
      
      Add a test so that further breakage is visible.
      
      This got broken in 16828d5c.
      
      Discussion: https://postgr.es/m/20180403204723.fqte755nukgm42uf@alvherre.pgsql
      cd5005bc
    • Tom Lane's avatar
      Prevent accidental linking of system-supplied copies of libpq.so etc. · dddfc4cb
      Tom Lane authored
      We were being careless in some places about the order of -L switches in
      link command lines, such that -L switches referring to external directories
      could come before those referring to directories within the build tree.
      This made it possible to accidentally link a system-supplied library, for
      example /usr/lib/libpq.so, in place of the one built in the build tree.
      Hilarity ensued, the more so the older the system-supplied library is.
      
      To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNAL
      and the main LDFLAGS variable, both of which are "recursively expanded"
      so that they can be incrementally adjusted by different makefiles.
      Establish a policy that -L switches for directories in the build tree
      must always be added to LDFLAGS_INTERNAL, while -L switches for external
      directories must always be added to LDFLAGS.  This is sufficient to
      ensure a safe search order.  For simplicity, we typically also put -l
      switches for the respective libraries into those same variables.
      (Traditional make usage would have us put -l switches into LIBS, but
      cleaning that up is a project for another day, as there's no clear
      need for it.)
      
      This turns out to also require separating SHLIB_LINK into two variables,
      SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about which
      switches go into which variable.  And likewise for PG_LIBS.
      
      Although this change might appear to affect external users of pgxs.mk,
      I think it doesn't; they shouldn't have any need to touch the _INTERNAL
      variables.
      
      In passing, tweak src/common/Makefile so that the value of CPPFLAGS
      recorded in pg_config lacks "-DFRONTEND" and the recorded value of
      LDFLAGS lacks "-L../../../src/common".  Both of those things are
      mistakes, apparently introduced during prior code rearrangements,
      as old versions of pg_config don't print them.  In general we don't
      want anything that's specific to the src/common subdirectory to
      appear in those outputs.
      
      This is certainly a bug fix, but in view of the lack of field
      complaints, I'm unsure whether it's worth the risk of back-patching.
      In any case it seems wise to see what the buildfarm makes of it first.
      
      Discussion: https://postgr.es/m/25214.1522604295@sss.pgh.pa.us
      dddfc4cb
    • Tom Lane's avatar
      Suppress compiler warning in new jsonb_plperl code. · d4a4c3d5
      Tom Lane authored
      Some compilers are evidently pickier than others about whether Perl's
      I32 typedef should be considered equivalent to int.  Dodge the problem
      by using a separate variable; the prior coding was a bit confusing anyway.
      
      Per buildfarm.  Note this does nothing to fix the test failures due to
      SV_to_JsonbValue not covering enough variable types.
      d4a4c3d5
    • Bruce Momjian's avatar
    • Teodor Sigaev's avatar
      Add prefix operator for TEXT type. · 710d90da
      Teodor Sigaev authored
      The prefix operator along with SP-GiST indexes can be used as an alternative
      for LIKE 'word%' commands  and it doesn't have a limitation of string/prefix
      length as B-Tree has.
      
      Bump catalog version
      
      Author: Ildus Kurbangaliev with some editorization by me
      Review by: Arthur Zakirov, Alexander Korotkov, and me
      Discussion: https://www.postgresql.org/message-id/flat/20180202180327.222b04b3@wp.localdomain
      710d90da
    • Peter Eisentraut's avatar
      4ab29998
    • Magnus Hagander's avatar
      Properly use INT64_FORMAT in output · 10d62d10
      Magnus Hagander authored
      Per buildfarm animal prairiedog, suggestion solution from Tom.
      10d62d10
    • Peter Eisentraut's avatar
      Transforms for jsonb to PL/Perl · 341e1661
      Peter Eisentraut authored
      Add a new contrib module jsonb_plperl that provides a transform between
      jsonb and PL/Perl.  jsonb values are converted to appropriate Perl types
      such as arrays and hashes, and vice versa.
      
      Author: Anthony Bykov <a.bykov@postgrespro.ru>
      Reviewed-by: default avatarPavel Stehule <pavel.stehule@gmail.com>
      Reviewed-by: default avatarAleksander Alekseev <a.alekseev@postgrespro.ru>
      Reviewed-by: default avatarNikita Glukhov <n.gluhov@postgrespro.ru>
      341e1661
    • Magnus Hagander's avatar
      Fix for checksum validation patch · a08dc711
      Magnus Hagander authored
      Reorder the check for non-BLCKSZ size reads to make sure we don't abort
      sending the file in this case.
      
      Missed in the previous commit.
      a08dc711
    • Magnus Hagander's avatar
      Validate page level checksums in base backups · 4eb77d50
      Magnus Hagander authored
      When base backups are run over the replication protocol (for example
      using pg_basebackup), verify the checksums of all data blocks if
      checksums are enabled. If checksum failures are encountered, log them
      as warnings but don't abort the backup.
      
      This becomes the default behaviour in pg_basebackup (provided checksums
      are enabled on the server), so add a switch (-k) to disable the checks
      if necessary.
      
      Author: Michael Banck
      Reviewed-By: Magnus Hagander, David Steele
      Discussion: https://postgr.es/m/20180228180856.GE13784@nighthawk.caipicrew.dd-dns.de
      4eb77d50
    • Simon Riggs's avatar
      Tab completion for MERGE · 4923550c
      Simon Riggs authored
      Author: Pavan Deolasee
      4923550c
    • Simon Riggs's avatar
      WITH support in MERGE · aa3faa3c
      Simon Riggs authored
      Author: Peter Geoghegan
      Recursive support removed, no tests
      Docs added by me
      aa3faa3c
    • Simon Riggs's avatar
      New files for MERGE · 83454e3c
      Simon Riggs authored
      83454e3c
    • Simon Riggs's avatar
      MERGE SQL Command following SQL:2016 · d204ef63
      Simon Riggs authored
      MERGE performs actions that modify rows in the target table
      using a source table or query. MERGE provides a single SQL
      statement that can conditionally INSERT/UPDATE/DELETE rows
      a task that would other require multiple PL statements.
      e.g.
      
      MERGE INTO target AS t
      USING source AS s
      ON t.tid = s.sid
      WHEN MATCHED AND t.balance > s.delta THEN
        UPDATE SET balance = t.balance - s.delta
      WHEN MATCHED THEN
        DELETE
      WHEN NOT MATCHED AND s.delta > 0 THEN
        INSERT VALUES (s.sid, s.delta)
      WHEN NOT MATCHED THEN
        DO NOTHING;
      
      MERGE works with regular and partitioned tables, including
      column and row security enforcement, as well as support for
      row, statement and transition triggers.
      
      MERGE is optimized for OLTP and is parameterizable, though
      also useful for large scale ETL/ELT. MERGE is not intended
      to be used in preference to existing single SQL commands
      for INSERT, UPDATE or DELETE since there is some overhead.
      MERGE can be used statically from PL/pgSQL.
      
      MERGE does not yet support inheritance, write rules,
      RETURNING clauses, updatable views or foreign tables.
      MERGE follows SQL Standard per the most recent SQL:2016.
      
      Includes full tests and documentation, including full
      isolation tests to demonstrate the concurrent behavior.
      
      This version written from scratch in 2017 by Simon Riggs,
      using docs and tests originally written in 2009. Later work
      from Pavan Deolasee has been both complex and deep, leaving
      the lead author credit now in his hands.
      Extensive discussion of concurrency from Peter Geoghegan,
      with thanks for the time and effort contributed.
      
      Various issues reported via sqlsmith by Andreas Seltenreich
      
      Authors: Pavan Deolasee, Simon Riggs
      Reviewer: Peter Geoghegan, Amit Langote, Tomas Vondra, Simon Riggs
      
      Discussion:
      https://postgr.es/m/CANP8+jKitBSrB7oTgT9CY2i1ObfOt36z0XMraQc+Xrz8QB0nXA@mail.gmail.com
      https://postgr.es/m/CAH2-WzkJdBuxj9PO=2QaO9-3h3xGbQPZ34kJH=HukRekwM-GZg@mail.gmail.com
      d204ef63
  3. 02 Apr, 2018 11 commits
    • Simon Riggs's avatar
      Revert "MERGE SQL Command following SQL:2016" · aa5877bb
      Simon Riggs authored
      This reverts commit e6597dc3.
      aa5877bb
    • Simon Riggs's avatar
      Revert "Modified files for MERGE" · 7cf8a5c3
      Simon Riggs authored
      This reverts commit 354f1385.
      7cf8a5c3
    • Simon Riggs's avatar
      Modified files for MERGE · 354f1385
      Simon Riggs authored
      354f1385
    • Simon Riggs's avatar
      MERGE SQL Command following SQL:2016 · e6597dc3
      Simon Riggs authored
      MERGE performs actions that modify rows in the target table
      using a source table or query. MERGE provides a single SQL
      statement that can conditionally INSERT/UPDATE/DELETE rows
      a task that would other require multiple PL statements.
      e.g.
      
      MERGE INTO target AS t
      USING source AS s
      ON t.tid = s.sid
      WHEN MATCHED AND t.balance > s.delta THEN
        UPDATE SET balance = t.balance - s.delta
      WHEN MATCHED THEN
        DELETE
      WHEN NOT MATCHED AND s.delta > 0 THEN
        INSERT VALUES (s.sid, s.delta)
      WHEN NOT MATCHED THEN
        DO NOTHING;
      
      MERGE works with regular and partitioned tables, including
      column and row security enforcement, as well as support for
      row, statement and transition triggers.
      
      MERGE is optimized for OLTP and is parameterizable, though
      also useful for large scale ETL/ELT. MERGE is not intended
      to be used in preference to existing single SQL commands
      for INSERT, UPDATE or DELETE since there is some overhead.
      MERGE can be used statically from PL/pgSQL.
      
      MERGE does not yet support inheritance, write rules,
      RETURNING clauses, updatable views or foreign tables.
      MERGE follows SQL Standard per the most recent SQL:2016.
      
      Includes full tests and documentation, including full
      isolation tests to demonstrate the concurrent behavior.
      
      This version written from scratch in 2017 by Simon Riggs,
      using docs and tests originally written in 2009. Later work
      from Pavan Deolasee has been both complex and deep, leaving
      the lead author credit now in his hands.
      Extensive discussion of concurrency from Peter Geoghegan,
      with thanks for the time and effort contributed.
      
      Various issues reported via sqlsmith by Andreas Seltenreich
      
      Authors: Pavan Deolasee, Simon Riggs
      Reviewers: Peter Geoghegan, Amit Langote, Tomas Vondra, Simon Riggs
      
      Discussion:
      https://postgr.es/m/CANP8+jKitBSrB7oTgT9CY2i1ObfOt36z0XMraQc+Xrz8QB0nXA@mail.gmail.com
      https://postgr.es/m/CAH2-WzkJdBuxj9PO=2QaO9-3h3xGbQPZ34kJH=HukRekwM-GZg@mail.gmail.com
      e6597dc3
    • Peter Eisentraut's avatar
      Fix XML syntax in documentation · a92f24fc
      Peter Eisentraut authored
      a92f24fc
    • Tom Lane's avatar
      Fix some dubious WAL-parsing code. · b01f32c3
      Tom Lane authored
      Coverity complained about possible buffer overrun in two places added by
      commit 1eb6d652, and AFAICS it's reasonable to worry: even granting that
      the WAL originator properly truncated the commit GID to GIDSIZE, we should
      not really bet our lives on that having the same value as it does in the
      current build.  Hence, use strlcpy() not strcpy(), and adjust the pointer
      advancement logic to be sure we skip over the whole source string even if
      strlcpy() truncated it.
      b01f32c3
    • Peter Eisentraut's avatar
      psql: Fix \ef, \sf tab completion · 05e85d35
      Peter Eisentraut authored
      \ef and \sf take any kind of routine, not just normal functions.
      
      Author: Pavel Stehule <pavel.stehule@gmail.com>
      05e85d35
    • Tom Lane's avatar
      Remove contrib/jsonb_plpython's tests for infinity and NaN conversions. · 6278a2a2
      Tom Lane authored
      These tests don't work reliably with pre-2.6 Python versions, since
      Python code like float('inf') was not guaranteed to work before that,
      even granting an IEEE-compliant platform.
      
      Since there's no explicit handling of these cases in jsonb_plpython,
      we're not adding any real code coverage by testing them, and thus
      it doesn't seem to make sense to go to any great lengths to work
      around the test instability.
      
      Discussion: https://postgr.es/m/E1f1AMU-00031c-9N@gemulon.postgresql.org
      6278a2a2
    • Tom Lane's avatar
      Teach configure --with-python to report the Python version number. · beff4bb9
      Tom Lane authored
      We already do this for Perl and some other interesting tools, so it
      seems sensible to do it for Python as well, especially since the
      sub-release number is never determinable from other configure output
      and even the major/minor numbers may not be clear without excavation
      in config.log.
      
      While at it, get rid of the code's assumption that both the major and
      minor numbers contain exactly one digit.  That will foreseeably be
      broken by Python 3.10 in perhaps four or five years.  That's far enough
      out that we probably don't need to back-patch this.
      
      Discussion: https://postgr.es/m/2186.1522681145@sss.pgh.pa.us
      beff4bb9
    • Peter Eisentraut's avatar
      Make be-secure-common.c more consistent for future SSL implementations · 2764d5dc
      Peter Eisentraut authored
      Recent commit 8a3d9425 has introduced be-secure-common.c, which is aimed
      at including backend-side APIs that can be used by any SSL
      implementation.  The purpose is similar to fe-secure-common.c for the
      frontend-side APIs.
      
      However, this has forgotten to include check_ssl_key_file_permissions()
      in the move, which causes a double dependency between be-secure.c and
      be-secure-openssl.c.
      
      Refactor the code in a more logical way.  This also puts into light an
      API which is usable by future SSL implementations for permissions on SSL
      key files.
      
      Author: Michael Paquier <michael@paquier.xyz>
      2764d5dc
    • Robert Haas's avatar
      postgres_fdw: Push down partition-wise aggregation. · 7e0d64c7
      Robert Haas authored
      Since commit 7012b132, postgres_fdw
      has been able to push down the toplevel aggregation operation to the
      remote server.  Commit e2f1eb0e made
      it possible to break down the toplevel aggregation into one
      aggregate per partition.  This commit lets postgres_fdw push down
      aggregation in that case just as it does at the top level.
      
      In order to make this work, this commit adds an additional argument
      to the GetForeignUpperPaths FDW API.  A matching argument is added
      to the signature for create_upper_paths_hook.  Third-party code using
      either of these will need to be updated.
      
      Also adjust create_foreignscan_plan() so that it picks up the correct
      set of relids in this case.
      
      Jeevan Chalke, reviewed by Ashutosh Bapat and by me and with some
      adjustments by me.  The larger patch series of which this patch is a
      part was also reviewed and tested by Antonin Houska, Rajkumar
      Raghuwanshi, David Rowley, Dilip Kumar, Konstantin Knizhnik, Pascal
      Legrand, and Rafia Sabih.
      
      Discussion: http://postgr.es/m/CAM2+6=V64_xhstVHie0Rz=KPEQnLJMZt_e314P0jaT_oJ9MR8A@mail.gmail.com
      Discussion: http://postgr.es/m/CAM2+6=XPWujjmj5zUaBTGDoB38CemwcPmjkRy0qOcsQj_V+2sQ@mail.gmail.com
      7e0d64c7
  4. 01 Apr, 2018 4 commits
    • Tom Lane's avatar
      0b11a674
    • Andres Freund's avatar
      Fix non-portable use of round(). · 686d399f
      Andres Freund authored
      round() is from C99.  Use rint() instead.  There are behavioral
      differences between round() and rint(), but they should not matter to
      the Bloom filter optimal_k() function.  We already assume POSIX
      behavior for rint(), so there is no question of rint() not using
      "rounds towards nearest" as its rounding mode.
      
      Cleanup from commit 51bc2717.
      
      Per buildfarm member thrips.
      
      Author: Peter Geoghegan
      Discussion: https://postgr.es/m/CAH2-Wzn76eCGUonARy-wrVtMHsf+4cvbK_oJAWTLfORTU5ki0w@mail.gmail.com
      686d399f
    • Andres Freund's avatar
      Add amcheck verification of heap relations belonging to btree indexes. · 7f563c09
      Andres Freund authored
      Add a new, optional, capability to bt_index_check() and
      bt_index_parent_check():  check that each heap tuple that should have an
      index entry does in fact have one.  The extra checking is performed at
      the end of the existing nbtree checks.
      
      This is implemented by using a Bloom filter data structure.  The
      implementation performs set membership tests within a callback (the same
      type of callback that each index AM registers for CREATE INDEX).  The
      Bloom filter is populated during the initial index verification scan.
      
      Reusing the CREATE INDEX infrastructure allows the new verification
      option to automatically benefit from the heap consistency checks that
      CREATE INDEX already performs.  CREATE INDEX does thorough sanity
      checking of HOT chains, so the new check actually manages to detect
      problems in heap-only tuples.
      
      Author: Peter Geoghegan
      Reviewed-By: Pavan Deolasee, Andres Freund
      Discussion: https://postgr.es/m/CAH2-Wzm5VmG7cu1N-H=nnS57wZThoSDQU+F5dewx3o84M+jY=g@mail.gmail.com
      7f563c09
    • Andres Freund's avatar
      Add Bloom filter implementation. · 51bc2717
      Andres Freund authored
      A Bloom filter is a space-efficient, probabilistic data structure that
      can be used to test set membership.  Callers will sometimes incur false
      positives, but never false negatives.  The rate of false positives is a
      function of the total number of elements and the amount of memory
      available for the Bloom filter.
      
      Two classic applications of Bloom filters are cache filtering, and data
      synchronization testing.  Any user of Bloom filters must accept the
      possibility of false positives as a cost worth paying for the benefit in
      space efficiency.
      
      This commit adds a test harness extension module, test_bloomfilter.  It
      can be used to get a sense of how the Bloom filter implementation
      performs under varying conditions.
      
      This is infrastructure for the upcoming "heapallindexed" amcheck patch,
      which verifies the consistency of a heap relation against one of its
      indexes.
      
      Author: Peter Geoghegan
      Reviewed-By: Andrey Borodin, Michael Paquier, Thomas Munro, Andres Freund
      Discussion: https://postgr.es/m/CAH2-Wzm5VmG7cu1N-H=nnS57wZThoSDQU+F5dewx3o84M+jY=g@mail.gmail.com
      51bc2717
  5. 31 Mar, 2018 1 commit