| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
| Cc: | Kirill Reshke <reshkekirill(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Kirill Gavrilov <diphantxm(at)gmail(dot)com>, "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, Euler Taveira <euler(at)eulerto(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Truncate logs by max_log_size |
| Date: | 2026-04-09 22:35:59 |
| Message-ID: | e687b0ab-86a0-4a13-9518-6f02a4668082@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 09/04/2026 20:11, Fujii Masao wrote:
> +$node->append_conf('postgresql.conf', "log_statement = 'all'\n");
>
> This doesn't seem necessary, since $node->init already sets
> log_statement = 'all'.
Removed.
Most likely still leftovers from previous attempts.
> +$node->append_conf('postgresql.conf', "log_statement_max_length = 20\n");
> +$node->reload();
> +my $log_offset = -s $node->logfile;
> +$node->psql('postgres', "SELECT '123456789ABCDEF'");
>
> Would it be simpler (and cheaper) to use SET instead of reloading the
> config? For example:
>
> ---------------------------
> my $log_offset = -s $node->logfile;
> $node->psql(
> 'postgres', "
> SET log_statement_max_length TO 20;
> SELECT '123456789ABCDEF';
> ");
> ---------------------------
Done.
It's indeed much simpler this way. I replaced all append + reload
postgresql.conf calls with SET.
> +char *
> +truncate_query_log(const char *query)
>
> In elog.c, truncate_query_log() is currently placed between write_stderr() and
> vwrite_stderr(). Since those two functions are related, it might be better to
> move truncate_query_log() to a more appropriate location. Thoughts?
Agreed.
The function now lives between check_log_of_query() and
get_backend_type_for_log(), which have more semantic overlap :)
> I see the patch has been moved to CommitFest PG20-1. Once development for v20
> starts, I'd like to commit it.
Terrific. Thanks!
Best, Jim
| Attachment | Content-Type | Size |
|---|---|---|
| v11-0001-Add-log_statement_max_length-GUC-to-limit-logged.patch | text/x-patch | 17.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-04-09 22:38:38 | Re: Allow a condition string in an injection point |
| Previous Message | Masahiko Sawada | 2026-04-09 22:11:24 | Re: test_autovacuum/001_parallel_autovacuum is broken |