From: | Peter Geoghegan <pg(at)heroku(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Marti Raudsepp <marti(at)juffo(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>, Greg Stark <stark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thom Brown <thom(at)linux(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: B-Tree support function number 3 (strxfrm() optimization) |
Date: | 2014-08-07 20:19:46 |
Message-ID: | CAM3SWZQLW26adkdo63HU=SzJMnnh25GE7uzV+7dbNN1CkaLSHA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Aug 7, 2014 at 12:17 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Gah. Hit send to soon. Also, as much as I'd prefer to avoid
> relitigating the absolutely stupid debate about how to expand the
> buffers, this is no good:
>
> + tss->buflen1 = Max(len1 + 1, tss->buflen1 * 2);
>
> If the first expansion is for a string >512MB and the second string is
> longer than the first, this will exceed MaxAllocSize and error out.
Fair point. I think this problem is already present in a few existing
places, but it shouldn't be. I suggest this remediation:
> + tss->buflen1 = Max(len1 + 1, Min(tss->buflen1 * 2, (int) MaxAllocSize));
I too would very much prefer to not repeat that debate. :-)
--
Peter Geoghegan
From | Date | Subject | |
---|---|---|---|
Next Message | Guillaume Lelarge | 2014-08-07 21:06:35 | Quick doc fix |
Previous Message | Tom Lane | 2014-08-07 19:54:36 | Re: Reporting the commit LSN at commit time |