Re: Change GUC hashtable to use simplehash?

Anton A. Melnikov <a.melnikov@postgrespro.ru>

From: "Anton A. Melnikov" <a.melnikov@postgrespro.ru>
To: John Naylor <johncnaylorls@gmail.com>, Jeff Davis <pgsql@j-davis.com>
Cc: Ants Aasma <ants.aasma@cybertec.at>, Heikki Linnakangas <hlinnaka@iki.fi>, Junwang Zhao <zhjwpku@gmail.com>, jian he <jian.universality@gmail.com>, Andres Freund <andres@anarazel.de>, Tom Lane <tgl@sss.pgh.pa.us>, Gurjeet Singh <gurjeet@singh.im>, pgsql-hackers@postgresql.org
Date: 2024-12-19T00:10:30Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Silence warning in older versions of Valgrind

  2. Revert "Speed up tail processing when hashing aligned C strings, take two"

  3. Speed up tail processing when hashing aligned C strings, take two

  4. Teach fasthash_accum to use platform endianness for bytewise loads

  5. Add macro to disable address safety instrumentation

  6. Convert uses of hash_string_pointer to fasthash equivalent

  7. Speed up tail processing when hashing aligned C strings

  8. Add helper functions for dshash tables with string keys.

  9. Fix warnings in cpluspluscheck

  10. Further cosmetic review of hashfn_unstable.h

  11. Simplify initialization of incremental hash state

  12. Add optimized C string hashing

  13. Add inline incremental hash functions for in-memory use

  14. Make all Perl warnings fatal

Hi!

Found that https://github.com/postgres/postgres/commit/0aba2554409ee3251d7558567edd114d8ed36dcc
produces a valgrind error in initdb.
Such a steps:
CPPFLAGS="-DUSE_VALGRIND -Og"  ./configure --enable-debug --enable-tap-tests --enable-cassert --with-icu
make ...
valgrind --quiet --exit-on-first-error=yes --error-exitcode=1 --leak-check=no --time-stamp=yes \
  --gen-suppressions=all --trace-children=yes <path-to>/initdb -k -D <path-to>/data

give an error:

running bootstrap script ... ok
performing post-bootstrap initialization ... ==00:00:00:01.856 967784== Conditional jump or move depends on uninitialised value(s)
==00:00:00:01.856 967784==    at 0x2F41F4: fasthash_accum (hashfn_unstable.h:136)
==00:00:00:01.856 967784==    by 0x2F41F4: fasthash_accum_cstring_aligned (hashfn_unstable.h:247)
==00:00:00:01.856 967784==    by 0x2F41F4: fasthash_accum_cstring (hashfn_unstable.h:271)
==00:00:00:01.856 967784==    by 0x2F41F4: spcachekey_hash (namespace.c:268)
==00:00:00:01.856 967784==    by 0x2F479F: nsphash_lookup (simplehash.h:836)
==00:00:00:01.856 967784==    by 0x2F479F: spcache_insert (namespace.c:379)
==00:00:00:01.856 967784==    by 0x2F533C: cachedNamespacePath (namespace.c:4236)
==00:00:00:01.856 967784==    by 0x2F5425: recomputeNamespacePath (namespace.c:4294)
==00:00:00:01.856 967784==    by 0x2F5516: RelnameGetRelid (namespace.c:875)
==00:00:00:01.856 967784==    by 0x2F6CD5: RangeVarGetRelidExtended (namespace.c:524)
==00:00:00:01.856 967784==    by 0x2DD1C7: objectNamesToOids (aclchk.c:701)
==00:00:00:01.856 967784==    by 0x2E2A9D: ExecuteGrantStmt (aclchk.c:441)
==00:00:00:01.856 967784==    by 0x61FF62: ProcessUtilitySlow (utility.c:1816)
==00:00:00:01.856 967784==    by 0x61E948: standard_ProcessUtility (utility.c:973)
==00:00:00:01.856 967784==    by 0x61EC1A: ProcessUtility (utility.c:530)
==00:00:00:01.856 967784==    by 0x61C059: PortalRunUtility (pquery.c:1158)
==00:00:00:01.856 967784==
{
    <insert_a_suppression_name_here>
    Memcheck:Cond
    fun:fasthash_accum
    fun:fasthash_accum_cstring_aligned
    fun:fasthash_accum_cstring
    fun:spcachekey_hash
    fun:nsphash_lookup
    fun:spcache_insert
    fun:cachedNamespacePath
    fun:recomputeNamespacePath
    fun:RelnameGetRelid
    fun:RangeVarGetRelidExtended
    fun:objectNamesToOids
    fun:ExecuteGrantStmt
    fun:ProcessUtilitySlow
    fun:standard_ProcessUtility
    fun:ProcessUtility
    fun:PortalRunUtility
}
==00:00:00:01.856 967784==
==00:00:00:01.856 967784== Exit program on first error (--exit-on-first-error=yes)
child process exited with exit code 1

The current master at b7493e1 also has this error.


With the best regards,

-- 
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company