Re: A qsort template
John Naylor <john.naylor@enterprisedb.com>
From: John Naylor <john.naylor@enterprisedb.com>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Peter Geoghegan <pg@bowt.ie>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-04-02T10:56:10Z
Lists: pgsql-hackers
On Sat, Apr 2, 2022 at 5:27 PM Thomas Munro <thomas.munro@gmail.com> wrote: > It looks like UBsan sees a problem, per BF animal kestrel: > > /mnt/resource/bf/build/kestrel/HEAD/pgsql.build/../pgsql/src/backend/utils/sort/tuplesort.c:722:51: > runtime error: load of value 96, which is not a valid value for type > 'bool' Yeah, same with tamandua. Then, skink (a Valgrind animal) shows: ==1940791== VALGRINDERROR-BEGIN ==1940791== Conditional jump or move depends on uninitialised value(s) ==1940791== at 0x73D394: ApplyInt32SortComparator (sortsupport.h:311) ==1940791== by 0x73D394: qsort_tuple_int32_compare (tuplesort.c:722) ==1940791== by 0x73D394: qsort_tuple_int32 (sort_template.h:313) ==1940791== by 0x7409BC: tuplesort_sort_memtuples (tuplesort.c:3613) ==1940791== by 0x742806: tuplesort_performsort (tuplesort.c:2154) ==1940791== by 0x23C109: heapam_relation_copy_for_cluster (heapam_handler.c:955) ==1940791== by 0x35799A: table_relation_copy_for_cluster (tableam.h:1658) ==1940791== by 0x35799A: copy_table_data (cluster.c:913) ==1940791== by 0x359016: rebuild_relation (cluster.c:606) ==1940791== by 0x35914E: cluster_rel (cluster.c:427) ==1940791== by 0x3594EB: cluster (cluster.c:195) ==1940791== by 0x5C73FF: standard_ProcessUtility (utility.c:862) ==1940791== by 0x5C78D0: ProcessUtility (utility.c:530) ==1940791== by 0x5C4C7B: PortalRunUtility (pquery.c:1158) ==1940791== by 0x5C4F78: PortalRunMulti (pquery.c:1315) ==1940791== Uninitialised value was created by a stack allocation ==1940791== at 0x74224E: tuplesort_putheaptuple (tuplesort.c:1800) -- John Naylor EDB: http://www.enterprisedb.com
Commits
-
Remove debug messages from tuplesort_sort_memtuples()
- 6e647ef0e750 15.0 landed
-
Fix performance regression in tuplesort specializations
- 99c754129d78 15.0 landed
-
Fix tuplesort optimization for CLUSTER-on-expression.
- cc58eecc5d75 15.0 landed
-
Initial pgindent and pgperltidy run for v14.
- def5b065ff22 14.0 cited
-
Specialize checkpointer sort functions.
- 1b88b8908e75 14.0 landed
-
Use sort_template.h for qsort() and qsort_arg().
- f374f4d66425 14.0 landed
-
Use sort_template.h for qsort_tuple() and qsort_ssup().
- 8eda3eba3063 14.0 landed
-
Add sort_template.h for making sort functions.
- 0a1f1d3cac6b 14.0 landed
-
Use abbreviated keys for faster sorting of text datums.
- 4ea51cdfe85c 9.5.0 cited