From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: Atomics for heap_parallelscan_nextpage() |
Date: | 2017-08-16 14:51:55 |
Message-ID: | ec67764d-2e6a-5b3b-fdde-00443542ef79@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 08/16/2017 04:20 PM, Heikki Linnakangas wrote:
> On 05/06/2017 04:57 PM, David Rowley wrote:
>> Andres mentioned in [2] that it might be worth exploring using
>> atomics to do the same job. So I went ahead and did that, and came
>> up with the attached, which is a slight variation on what he
>> mentioned in the thread.
>>
>> To keep things a bit more simple, and streamline, I ended up
>> pulling out the logic for setting the startblock into another
>> function, which we only call once before the first call to
>> heap_parallelscan_nextpage(). I also ended up changing phs_cblock
>> and replacing it with a counter that always starts at zero. The
>> actual block is calculated based on that + the startblock modulo
>> nblocks. This makes things a good bit more simple for detecting
>> when we've allocated all the blocks to the workers, and also works
>> nicely when wrapping back to the start of a relation when we
>> started somewhere in the middle due to piggybacking with a
>> synchronous scan.
>
> Looks reasonable. I edited the comments and the variable names a bit,
> to my liking, and committed. Thanks!
A couple of 32-bit x86 buildfarm members don't seem to be happy with
this. I'll investigate, but if anyone has a clue, I'm all ears...
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2017-08-16 14:56:16 | Re: recovery_target_time = 'now' is not an error but still impractical setting |
Previous Message | Tom Lane | 2017-08-16 14:20:11 | Re: taking stdbool.h into use |