RE: Log a sample of transactions

From: "Kuroda, Hayato" <kuroda(dot)hayato(at)jp(dot)fujitsu(dot)com>
To: 'Adrien NAYRAT' <adrien(dot)nayrat(at)anayrat(dot)info>, "'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-01-28 01:53:51
Message-ID: 1F66B161998C704BABF8989B8A2AC0A316CB7E@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Adrien,

>> * xact_is_sampled is left at the end of a transaction.
>> Should the parameter be set to false at the lowest layer of the transaction system?
>> I understand it is unnecessary for the functionality, but it have more symmetry.
>
> Yes, it is not necessary. I wonder what is more important : keep some
>kind of symmetry or avoid unnecessary code (which can be source of mistake)?

>>
>> * check_log_duration should be used only when postgres check the duration.
>> But I'm not sure a new function such as check_is_sampled is needed because A processing in new function will be as almost same as check_log_duration.

> I agree, I asked myself the same question and I preferred to keep code
simple.

I think your point is also correct.
You should inquire superior reviewers or committers because I cannot judge which one is better.

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.

Best Regards,
Hayato Kuroda
Fujitsu LIMITED

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2019-01-28 02:45:20 Re: Use an enum for RELKIND_*?
Previous Message Imai, Yoshikazu 2019-01-28 01:44:28 RE: speeding up planning with partitions