Reduce log level of some logical decoding messages to DEBUG1 - Mailing list pgsql-hackers

From Fujii Masao
Subject Reduce log level of some logical decoding messages to DEBUG1
Date
Msg-id CAHGQGwGTyHgtD9tyN664x6vQ8Q1G53H7ZUCgBU9_X=nLt3f1QA@mail.gmail.com
Whole thread
Responses Re: Reduce log level of some logical decoding messages to DEBUG1
List pgsql-hackers
Hi,

In logical decoding, messages like the following are currently logged at
LOG level:

    LOG:  starting logical decoding for slot "myslot"
    DETAIL:  Streaming transactions committing after 0/030872C0,
reading WAL from 0/03087288.
    STATEMENT:  ...
    LOG:  logical decoding found consistent point at 0/03087288
    DETAIL:  There are no running transactions.
    STATEMENT:  ...

These can be useful for debugging, but DBAs are typically not interested in
them. They can also be emitted frequently, for example, on each call to
functions like pg_logical_slot_peek_binary_changes() or
pg_replication_slot_advance() etc. When such functions are called repeatedly,
the logs can quickly become noisy.

The slotsync worker can also generate these messages periodically. Due to
the issue discussed at [1], this can currently happen as often as every 200ms
(which should be fixed separately). Even without that issue, these messages
would be still emitted regularly.

Given that these are mostly developer-oriented messages, logging them at
LOG level seems too verbose. I'm proposing to reduce their level to DEBUG1.
A patch is attached.

Alternatively, if we want to keep them at LOG by default, we could introduce
a GUC like trace_logical_decoding_messages, similar to
the old trace_recovery_messages, to control their verbosity independently
of log_min_messages.

Thought?

This topic came up in [1] and [2], and Amit suggested discussing it separately,
so I started this thread.

Regards,

[1] https://postgr.es/m/CAHGQGwF6zG9Z8ws1yb3hY1VqV-WT7hR0qyXCn2HdbjvZQKufDw@mail.gmail.com
[2] https://postgr.es/m/CAHGQGwED5kJxZ_MdCh=WLa5M7ekXdnzCO1ZCQhQNCEdfaEPwFQ@mail.gmail.com

-- 
Fujii Masao

Attachment

pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: Adding locks statistics
Next
From: Xuneng Zhou
Date:
Subject: Re: tablecmds: fix bug where index rebuild loses replica identity on partitions