Re: Log a sample of transactions

From: Adrien Nayrat <adrien(dot)nayrat(at)anayrat(dot)info>
To: "Kuroda, Hayato" <kuroda(dot)hayato(at)jp(dot)fujitsu(dot)com>, "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Log a sample of transactions
Date: 2019-02-03 11:23:00
Message-ID: bb095cee-9fab-f814-1831-b6c06fbcf744@anayrat.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/28/19 2:53 AM, Kuroda, Hayato wrote:
> BTW, I give you a suggestion about a test.
> This parameter enables users to log statements randomly, hence adding some tests is very difficult.
> Perhaps Only three cases are available:
>
> * When log_transaction_sample_rate is set to 1, all statements are logged.
> * When the parameter is set to 0, they are never logged.
> * When the parameter change to 0 inside the transaction, logging is immediately stopped.

I agree we should add tests, my main problem is log output contains duration
information:

postgres=# select 1;
LOG: duration: 0.539 ms statement: select 1;

I did not find any test for log_min_duration that could help me. LCOV indicate
there is no tests on this part (look check_log_duration()):
https://coverage.postgresql.org/src/backend/tcop/postgres.c.gcov.html

I will look how to test this properly with test infrastructure. Maybe a simple
regex to remove duration part will be enough.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2019-02-03 11:56:29 Re: Shared Memory: How to use SYSV rather than MMAP ?
Previous Message Vik Fearing 2019-02-03 11:16:59 Re: Early WIP/PoC for inlining CTEs