From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Andres Freund <andres@anarazel.de>
Cc: Tomas Vondra <tomas.vondra@postgresql.org>
Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
Subject: Re: pgsql: Add support for multivariate MCV lists
Date: Wed, 3 Apr 2019 01:25:40 +0200
Message-ID: <20190402232540.6teidt2s6dcxj6r5@development> (raw)
In-Reply-To: <20190329192510.GB1136@development>
References: <CAH2-Wzn8qvKsw3bgixXymQ6CAHTA3Vofw7vCUAFV0qGcTmkerg@mail.gmail.com>
<20190327201346.GB21957@development>
<20190327203353.GC21957@development>
<20190328012752.GD4406@development>
<CAH2-Wzn8oZqSK1rZ2Hvn1v9SeXZ-YsrTq-2kX3p+zW8bPFgaZQ@mail.gmail.com>
<20190328183336.GB16397@development>
<20190328193711.GC16397@development>
<20190329182013.GB8733@development>
<CAH2-WzmWJTNztxyAmK09jEqU0SXkvotfhcbYn5+KC5+erCdDhw@mail.gmail.com>
<20190329192510.GB1136@development>
On Fri, Mar 29, 2019 at 08:25:10PM +0100, Tomas Vondra wrote:
>On Fri, Mar 29, 2019 at 12:06:26PM -0700, Peter Geoghegan wrote:
>>On Fri, Mar 29, 2019 at 11:20 AM Tomas Vondra
>><tomas.vondra@2ndquadrant.com> wrote:
>>>I've pushed a fix for this. The short version is that the serialized
>>>representation was not respecting memory alignment requirements, which was
>>>causing issues in machines sensitive to this (ia64, sparc, hppa). It's a
>>>blind attempt, as I currently don't have access to any such machine.
>>
>>Looks like gharial still has problems:
>>
>>https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=gharial&dt=2019-03-29%2018%3A30%3A47
>>
>
>Yeah, I saw that :-(
>
>Unfortunately fixing this without access to any ia64/sparc/hppa machine
>will be hard. The only thing I can do is wait for gaur/snapper to report
>the failure with a backtrace.
>
OK, so the second memory-alignment fix I pushed on Saturday seems to
have worked. There's one aspect of it that I don't like though - the
MCV is first serialized into a buffer, which is then copied into the
varlena buffer. Deserialization works in reverse, i.e. it copies the
data from the varlena, then accessed the copy.
For the emergency fix that seemed acceptable, as it somewhat reduced the
amount of modified code, but I don't want to leave it like that because
of efficiency and memory consumption. So barring objections I'll push
the attached patch, which ensures proper memory alignment within the raw
varlena buffer. Thus the copies are not needed.
(The second part of the patch merely adds some alignment-enforcing
asserts - I don't plan to commit that, but if someone plans decides to
test this, it might be useful.)
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachments:
0001-improve-mcv-serialization.patch (text/plain, 0B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tomas.vondra@2ndquadrant.com, pg@bowt.ie, andres@anarazel.de, tomas.vondra@postgresql.org
Subject: Re: pgsql: Add support for multivariate MCV lists
In-Reply-To: <20190402232540.6teidt2s6dcxj6r5@development>
References: <CAH2-Wzn8qvKsw3bgixXymQ6CAHTA3Vofw7vCUAFV0qGcTmkerg@mail.gmail.com> <20190327201346.GB21957@development> <20190327203353.GC21957@development> <20190328012752.GD4406@development> <CAH2-Wzn8oZqSK1rZ2Hvn1v9SeXZ-YsrTq-2kX3p+zW8bPFgaZQ@mail.gmail.com> <20190328183336.GB16397@development> <20190328193711.GC16397@development> <20190329182013.GB8733@development> <CAH2-WzmWJTNztxyAmK09jEqU0SXkvotfhcbYn5+KC5+erCdDhw@mail.gmail.com> <20190329192510.GB1136@development> <20190402232540.6teidt2s6dcxj6r5@development>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox