Re: pure parsers and reentrant scanners

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pure parsers and reentrant scanners
Date: 2024-12-16 07:39:06
Message-ID: 255fe972-dea4-4d9d-b68e-705f032d72c8@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 02.12.24 10:46, Peter Eisentraut wrote:
> This patch series changes several parsers in the backend and contrib
> modules to use bison pure parsers and flex reentrant scanners. This is
> ultimately toward thread-safety, but I think it's also just nicer in
> general, and it might also fix a few possible small memory leaks.

I did a bit more work on this, so here is an updated patch set.

> Not done yet:
> * src/backend/utils/misc/guc-file.l
> * src/pl/plpgsql/src/pl_gram.y

I converted both of these scanners to reentrant, but I haven't done the
plpgsql parser yet.

> Not relevant for backend thread-safety:
> * src/backend/bootstrap/
>
> It might make sense to eventually covert that one as well, just so that
> the APIs are kept similar. But that could be for later.

I have done this one.

I'll leave it at this for now and wait for some reviews.

Attachment Content-Type Size
v1-0001-cube-pure-parser-and-reentrant-scanner.patch text/plain 7.0 KB
v1-0002-cube-Use-palloc-instead-of-malloc-for-flex.patch text/plain 1.6 KB
v1-0003-cube-Simplify-flex-scan-buffer-management.patch text/plain 1.8 KB
v1-0004-seg-pure-parser-and-reentrant-scanner.patch text/plain 6.2 KB
v1-0005-seg-Use-palloc-instead-of-malloc-for-flex.patch text/plain 1.2 KB
v1-0006-seg-Simplify-flex-scan-buffer-management.patch text/plain 1.5 KB
v1-0007-replication-parser-pure-parser-and-reentrant-scan.patch text/plain 8.6 KB
v1-0008-replication-parser-Use-palloc-instead-of-malloc-f.patch text/plain 1.4 KB
v1-0009-replication-parser-Simplify-flex-scan-buffer-mana.patch text/plain 1.3 KB
v1-0010-syncrep-parser-pure-parser-and-reentrant-scanner.patch text/plain 6.2 KB
v1-0011-syncrep-parser-Use-palloc-instead-of-malloc-for-f.patch text/plain 1.3 KB
v1-0012-syncrep-parser-Simplify-flex-scan-buffer-manageme.patch text/plain 1.2 KB
v1-0013-syncrep-parser-Use-flex-yyextra.patch text/plain 1.9 KB
v1-0014-jsonpath-scanner-reentrant-scanner.patch text/plain 10.3 KB
v1-0015-jsonpath-scanner-Use-flex-yyextra.patch text/plain 12.1 KB
v1-0016-bootstrap-pure-parser-and-reentrant-scanner.patch text/plain 7.2 KB
v1-0017-bootstrap-Use-palloc-instead-of-malloc-for-flex.patch text/plain 1.4 KB
v1-0018-guc-reentrant-scanner.patch text/plain 3.7 KB
v1-0019-plpgsql-reentrant-scanner.patch text/plain 51.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2024-12-16 08:00:00 Re: Visibility bug with prepared transaction with subtransactions on standby
Previous Message jian he 2024-12-16 07:07:51 using index to speedup add not null constraints to a table