RE: Log a sample of transactions

Kuroda, Hayato <kuroda.hayato@jp.fujitsu.com>

From: "Kuroda, Hayato" <kuroda.hayato@jp.fujitsu.com>
To: 'Adrien NAYRAT' <adrien.nayrat@anayrat.info>, "'pgsql-hackers@lists.postgresql.org'" <pgsql-hackers@lists.postgresql.org>
Date: 2019-01-23T02:12:15Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Tweak docs for log_statement_sample_rate

Dear Adrien,

> Hum, I am not an english native speaker, I choosed "rate" because it is 
> already used for auto_explain.sample_rate and for log_statement_sample_rate

If the community agree those name, renaming parameters are not needed.
Consistency is the most important in a DBMS. :-)

I read your source code and I thought it is generally good.
Here are some minor suggestions, but you don't have to follow strictly:

---- config.sgml ----
You must document the behavior when users change the parameter during a transaction.
あやしい・・・
 
---- postgres.c ----
I give you three comments.

> /* flag for logging statements in this transaction */
I think "a" or the plural form should be used instead of "this"

* 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.

* 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.


Best Regards,
Hayato Kuroda
Fujitsu LIMITED