Re: A qsort template

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A qsort template
Date: 2022-04-02 10:26:31
Message-ID: CA+hUKG+67T0nr1mcB2cFkKYktWc2TFh52QWfvGdvf259Ah+PhA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Apr 2, 2022 at 9:38 PM John Naylor <john(dot)naylor(at)enterprisedb(dot)com> wrote:
> On Fri, Apr 1, 2022 at 4:43 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> > On Thu, Mar 31, 2022 at 11:09 PM John Naylor
> > <john(dot)naylor(at)enterprisedb(dot)com> wrote:
> > > In a couple days I'm going to commit the v3 patch "accelerate tuple
> > > sorting for common types" as-is after giving it one more look, barring
> > > objections.
>
> Pushed.

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'

#5 0x0000000000eb65d4 in qsort_tuple_int32_compare (a=0x4292ce0,
b=0x4292cf8, state=0x4280130) at
/mnt/resource/bf/build/kestrel/HEAD/pgsql.build/../pgsql/src/backend/utils/sort/tuplesort.c:722
#6 qsort_tuple_int32 (data=<optimized out>, n=133,
arg=arg(at)entry=0x4280130) at
/mnt/resource/bf/build/kestrel/HEAD/pgsql.build/../pgsql/src/include/lib/sort_template.h:313
#7 0x0000000000eaf747 in tuplesort_sort_memtuples
(state=state(at)entry=0x4280130) at
/mnt/resource/bf/build/kestrel/HEAD/pgsql.build/../pgsql/src/backend/utils/sort/tuplesort.c:3613
#8 0x0000000000eaedcb in tuplesort_performsort
(state=state(at)entry=0x4280130) at
/mnt/resource/bf/build/kestrel/HEAD/pgsql.build/../pgsql/src/backend/utils/sort/tuplesort.c:2154
#9 0x0000000000573d60 in heapam_relation_copy_for_cluster
(OldHeap=<optimized out>, NewHeap=<optimized out>, OldIndex=<optimized
out>, use_sort=<optimized out>, OldestXmin=11681,
xid_cutoff=<optimized out>, multi_cutoff=0x7ffecb0cfa70,
num_tuples=0x7ffecb0cfa38, tups_vacuumed=0x7ffecb0cfa20,
tups_recently_dead=0x7ffecb0cfa28) at
/mnt/resource/bf/build/kestrel/HEAD/pgsql.build/../pgsql/src/backend/access/heap/heapam_handler.c:955

Reproduced locally, using the same few lines from the cluster.sql
test. I'll try to dig more tomorrow...

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-04-02 10:35:35 Re: logical decoding and replication of sequences
Previous Message Andrei Zubkov 2022-04-02 10:12:54 Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements