From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
---|---|
To: | Andreas Karlsson <andreas(at)proxel(dot)se>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pure parsers and reentrant scanners |
Date: | 2024-12-19 20:57:55 |
Message-ID: | 675c3436-6ba6-4681-9655-0753d9434e29@eisentraut.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 19.12.24 13:48, Peter Eisentraut wrote:
> On 17.12.24 01:46, Andreas Karlsson wrote:
>> On 12/16/24 8:39 AM, Peter Eisentraut wrote:
>>> I'll leave it at this for now and wait for some reviews.
>>
>> I really like this work since it makes the code cleaner to read on top
>> of paving the way for threading.
>>
>> Reviewed the patches and found a couple of issues.
>>
>> - Shouldn't yyext in syncrep_scanner_init() be allocated on the heap?
>> Or at least on the stack but by the caller?
>
> I think it's correct the way it is. It's only a temporary space for the
> scanner, so we can allocate it in the innermost scope.
>> - Also fixed the static remaining variables in the replication parser
>> in an attached patch.
>
> Thanks, I'll take a look at that.
I see what was going on here. I was allocating yyext as a local
variable in the init function and then it would go out of scope while
the scanner is still in use. That's why this didn't work for me. I had
written essentially the same patch as you for the replication scanner
yyextra but with a local variable, and it was "mysteriously" failing the
tests for me. Your solution is better. (For the jsonpath scanner, the
local variable works because the scanner init and shutdown are called
from the same function.)
Here is an updated patch set on top of what has been committed so far,
with all the issues you pointed out addressed.
Attachment | Content-Type | Size |
---|---|---|
v2-0001-replication-parser-pure-parser-and-reentrant-scan.patch | text/plain | 8.7 KB |
v2-0002-replication-parser-Use-palloc-instead-of-malloc-f.patch | text/plain | 1.4 KB |
v2-0003-replication-parser-Simplify-flex-scan-buffer-mana.patch | text/plain | 1.3 KB |
v2-0004-replication-parser-Use-flex-yyextra.patch | text/plain | 5.4 KB |
v2-0005-syncrep-parser-pure-parser-and-reentrant-scanner.patch | text/plain | 6.3 KB |
v2-0006-syncrep-parser-Use-palloc-instead-of-malloc-for-f.patch | text/plain | 1.3 KB |
v2-0007-syncrep-parser-Simplify-flex-scan-buffer-manageme.patch | text/plain | 1.2 KB |
v2-0008-syncrep-parser-Use-flex-yyextra.patch | text/plain | 2.3 KB |
v2-0009-jsonpath-scanner-reentrant-scanner.patch | text/plain | 20.7 KB |
v2-0010-guc-reentrant-scanner.patch | text/plain | 3.7 KB |
v2-0011-plpgsql-reentrant-scanner.patch | text/plain | 51.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Masahiko Sawada | 2024-12-19 21:12:02 | Re: Fix crash when non-creator being an iteration on shared radix tree |
Previous Message | David Rowley | 2024-12-19 20:36:56 | Re: Converting SetOp to read its two inputs separately |