pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Frits Jalvingh <jal@etc.to>
Cc: Dilip Kumar <dilipbalaut@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15225: [XX000] ERROR: invalid DSA memory alloc request size 1073741824 / Where: parallel worker
Date: Sat, 09 Jun 2018 11:51:37 -0400
Message-ID: <18767.1528559497@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEepm=2bMJTh=fuZFi2MbiKXUKTrF+Z7TVunTLJZP9c3ocaEgA@mail.gmail.com>
References: <152802081668.26724.16985037679312485972@wrigleys.postgresql.org>
	<CAEepm=1BYtYQSBJ7c=LrePT52Y5D+BeFjjHWOx3ACHDJJHBAig@mail.gmail.com>
	<CAKhTGFUro3Cf0qzmRHZ5nK7MrH2THA26RNgHH2q5+4VaoxCKPw@mail.gmail.com>
	<CAEepm=1nemj1wGLsnNrVqBLmqV9N6+6WToo=prGxAXafPYiTrA@mail.gmail.com>
	<CAKhTGFWcOeOatgjqdYZRr9qfxFQ8vauzdw-42rd+gm2S-PdZUg@mail.gmail.com>
	<CAFiTN-utouPD=Cjjd7BJyvQHXq-gtVn=oK2QjKtM_JqyQV-jow@mail.gmail.com>
	<CAKhTGFWrW7++cvFbU8=pG6FeqwA0sEDK_sK0rmmo_ZDRf2kQQw@mail.gmail.com>
	<CAEepm=08PiGBm2NjhugAd-wfPk=z7OMVNtGyS2ghbOYQZORxAg@mail.gmail.com>
	<CAEepm=2bMJTh=fuZFi2MbiKXUKTrF+Z7TVunTLJZP9c3ocaEgA@mail.gmail.com>

Thomas Munro <thomas.munro@enterprisedb.com> writes:
> Here is a tidier version that I'd like to commit before beta2, if
> there are no objections.  I've added this to the PostgreSQL 11 open
> items page.

That looks fine as far as it goes.  But I noticed that the code that
actually resizes the hashtable looks like

                /* Double the size of the bucket array. */
                pstate->nbuckets *= 2;
                size = pstate->nbuckets * sizeof(dsa_pointer_atomic);
                hashtable->batches[0].shared->size += size / 2;
                dsa_free(hashtable->area, hashtable->batches[0].shared->buckets);
                hashtable->batches[0].shared->buckets =
                    dsa_allocate(hashtable->area, size);
                buckets = (dsa_pointer_atomic *)
                    dsa_get_address(hashtable->area,
                                    hashtable->batches[0].shared->buckets);
                for (i = 0; i < pstate->nbuckets; ++i)
                    dsa_pointer_atomic_init(&buckets[i], InvalidDsaPointer);

with no apparent provision for failure of the realloc.  So the first
question is does the query actually fail cleanly if dsa_allocate gets
an OOM, and the second is whether we really want to fail the query in
such a case, rather than plow ahead with the existing bucket array.

BTW, that method of updating shared->size would do credit to
Rube Goldberg.  Wouldn't this:

                hashtable->batches[0].shared->size = size;

be both faster and less confusing?

			regards, tom lane




view thread (15+ messages)  latest in thread

Message-ID: <18767.1528559497@sss.pgh.pa.us>
Permalink:  ../18767.1528559497@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18767.1528559497@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 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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, thomas.munro@enterprisedb.com, jal@etc.to, dilipbalaut@gmail.com
  Subject: Re: BUG #15225: [XX000] ERROR: invalid DSA memory alloc request size 1073741824 / Where: parallel worker
  In-Reply-To: <18767.1528559497@sss.pgh.pa.us>
  References: <152802081668.26724.16985037679312485972@wrigleys.postgresql.org> <CAEepm=1BYtYQSBJ7c=LrePT52Y5D+BeFjjHWOx3ACHDJJHBAig@mail.gmail.com> <CAKhTGFUro3Cf0qzmRHZ5nK7MrH2THA26RNgHH2q5+4VaoxCKPw@mail.gmail.com> <CAEepm=1nemj1wGLsnNrVqBLmqV9N6+6WToo=prGxAXafPYiTrA@mail.gmail.com> <CAKhTGFWcOeOatgjqdYZRr9qfxFQ8vauzdw-42rd+gm2S-PdZUg@mail.gmail.com> <CAFiTN-utouPD=Cjjd7BJyvQHXq-gtVn=oK2QjKtM_JqyQV-jow@mail.gmail.com> <CAKhTGFWrW7++cvFbU8=pG6FeqwA0sEDK_sK0rmmo_ZDRf2kQQw@mail.gmail.com> <CAEepm=08PiGBm2NjhugAd-wfPk=z7OMVNtGyS2ghbOYQZORxAg@mail.gmail.com> <CAEepm=2bMJTh=fuZFi2MbiKXUKTrF+Z7TVunTLJZP9c3ocaEgA@mail.gmail.com> <18767.1528559497@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