From: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Nicholas White <n(dot)j(dot)white(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Jeff Davis <pgsql(at)j-davis(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Troels Nielsen <bn(dot)troels(at)gmail(dot)com>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls |
Date: | 2013-09-27 19:56:35 |
Message-ID: | 5245E2F3.7040409@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 27.09.2013 14:12, Robert Haas wrote:
> On Thu, Sep 26, 2013 at 4:20 PM, Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com> wrote:
>> But how do we ensure that the BMS is allocated in a context? You'd have
>> to switch contexts each time you call bms_add_member. I don't have a
>> good answer to this.
>
> The coding of bms_add_member is pretty funky. Why doesn't it just
> repalloc() the input argument if it's not big enough? If it did that,
> the new allocation would be in the same memory context as the original
> one, and we'd not need to care about the memory context when adding an
> element to an already non-empty set.
>
> But even if we did decide to switch memory contexts on every call, it
> would still be much cleaner than this. It's only three lines of code
> (and about as many instructions) to save and restore
> CurrentMemoryContext.
[looks] Huh, yeah, as it stands, bms_add_member() is an accident waiting
to happen. It's totally non-obvious that it might cause the BMS to jump
from another memory context to CurrentMemoryContext. Same with
bms_add_members(). And it would be good to Assert in bms_join that both
arguments are in the same from MemoryContext.
Let's fix that...
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2013-09-27 20:28:37 | Re: [PERFORM] Cpu usage 100% on slave. s_lock problem. |
Previous Message | Jim Nasby | 2013-09-27 19:14:35 | Re: Minmax indexes |