pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@bowt.ie>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Add deduplication to nbtree.
Date: Sun, 01 Mar 2020 13:24:55 -0500
Message-ID: <27003.1583087095@sss.pgh.pa.us> (raw)
In-Reply-To: <E1j73sn-0003FQ-KO@gemulon.postgresql.org>
References: <E1j73sn-0003FQ-KO@gemulon.postgresql.org>

Peter Geoghegan <pg@bowt.ie> writes:
> Add deduplication to nbtree.

Coverity isn't very happy with the coding in _bt_update_posting():

*** CID 1460433:  Memory - corruptions  (ARRAY_VS_SINGLETON)
/srv/coverity/git/pgsql-git/postgresql/src/backend/access/nbtree/nbtdedup.c: 723 in _bt_update_posting()
717     	{
718     		if (d < vacposting->ndeletedtids && vacposting->deletetids[d] == i)
719     		{
720     			d++;
721     			continue;
722     		}
>>>     CID 1460433:  Memory - corruptions  (ARRAY_VS_SINGLETON)
>>>     Using "htids" as an array.  This might corrupt or misinterpret adjacent memory locations.
723     		htids[ui++] = *BTreeTupleGetPostingN(origtuple, i);
724     	}
725     	Assert(ui == nhtids);
726     	Assert(d == vacposting->ndeletedtids);
727     	Assert(nhtids == 1 || _bt_posting_valid(itup));

I can see its point: asserting after the fact that you didn't clobber
memory isn't a terribly safe coding method, especially in a production
build where you won't even have the asserts.  Not sure if there's a
better way though.

			regards, tom lane





view thread (22+ messages)  latest in thread

Message-ID: <27003.1583087095@sss.pgh.pa.us>
Permalink:  ../27003.1583087095@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27003.1583087095@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pg@bowt.ie, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add deduplication to nbtree.
  In-Reply-To: <27003.1583087095@sss.pgh.pa.us>

* 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