From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> |
Cc: | Frits Jalvingh <jal(at)etc(dot)to>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #15225: [XX000] ERROR: invalid DSA memory alloc request size 1073741824 / Where: parallel worker |
Date: | 2018-06-09 15:51:37 |
Message-ID: | 18767.1528559497@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-06-09 16:06:54 | Re: BUG #15235: Getting failure message "Restore archive operation failed" while restoring database |
Previous Message | Jeff Janes | 2018-06-09 12:52:48 | Re: BUG #15235: Getting failure message "Restore archive operation failed" while restoring database |