RE: Log a sample of transactions - Mailing list pgsql-hackers

From Kuroda, Hayato
Subject RE: Log a sample of transactions
Date
Msg-id 1F66B161998C704BABF8989B8A2AC0A316CB7E@G01JPEXMBYT05
Whole thread Raw
In response to Re: Log a sample of transactions  (Adrien NAYRAT <adrien.nayrat@anayrat.info>)
Responses Re: Log a sample of transactions  (Adrien Nayrat <adrien.nayrat@anayrat.info>)
List 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
almostsame 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


pgsql-hackers by date:

Previous
From: "Imai, Yoshikazu"
Date:
Subject: RE: speeding up planning with partitions
Next
From: Kyotaro HORIGUCHI
Date:
Subject: Re: Use an enum for RELKIND_*?