Re: Custom tuplesorts for extensions

From: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Maxim Orlov <orlovmg(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Custom tuplesorts for extensions
Date: 2022-07-22 15:56:20
Message-ID: CALT9ZEEb_rqGNHy8weVkEuZ2NnqwGx17-bOZ5tdPL=1bvTa80Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've looked through the updated patch. Overall it looks good enough.

Some minor things:

- PARALLEL_SORT macro is based on coordinate struct instead of state
struct. In some calls(i.e. from _bt_spools_heapscan) coordinate could
appear to be NULL, which can be a segfault on items dereference inside the
macro.

- state->worker and coordinate->isWorker a little bit differ in semantics
i.e.:
..............................................worker............... leader
state -> worker........................ >=0.....................-1
coordinate ->isWorker............. 1..........................0

- in tuplesort_begin_index_btree I suppose it should be base->nKeys instead
of state->nKeys

- Cfbot reports gcc warnings due to mixed code and declarations. So I used
this to beautify code in tuplesortvariants.c a little. (This is added as a
separate patch 0007)

All these things are corrected/done in a new version 3 of a patchset (PFA).
For me, the patchset seems like a long-needed thing to support PostgreSQL
extensibility. Overall corrections in v3 are minor, so I'd like to mark the
patch as RfC if there are no objections.

--
Best regards,
Pavel Borisov
Supabase.

Attachment Content-Type Size
v3-0001-Remove-Tuplesortstate.copytup-function.patch application/octet-stream 16.7 KB
v3-0007-Tuplesort-code-beautification.patch application/octet-stream 22.7 KB
v3-0006-Split-tuplesortvariants.c-from-tuplesort.c.patch application/octet-stream 115.8 KB
v3-0004-Move-memory-management-away-from-writetup-and-tup.patch application/octet-stream 8.2 KB
v3-0005-Split-TuplesortPublic-from-Tuplesortstate.patch application/octet-stream 69.6 KB
v3-0003-Put-abbreviation-logic-into-puttuple_common.patch application/octet-stream 10.7 KB
v3-0002-Add-new-Tuplesortstate.removeabbrev-function.patch application/octet-stream 10.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2022-07-22 16:08:30 Re: Expose Parallelism counters planned/execute in pg_stat_statements
Previous Message Anthony Sotolongo 2022-07-22 15:17:52 Re: Expose Parallelism counters planned/execute in pg_stat_statements