Re: Problems around compute_query_id

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: Problems around compute_query_id
Date: 2021-04-15 07:43:59
Message-ID: 20210415074359.z3aqxkfv4p2gi4cp@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 12, 2021 at 02:56:59PM +0800, Julien Rouhaud wrote:
> I think we should simply document that %Q is not compatible with
> log_statements.

Hearing no objection I documented that limitation.

>
> > While making the feature run on some test server, I have noticed that
> > %Q would log some garbage query ID for autovacuum workers that's kept
> > around. That looks wrong.
>
> I've not been able to reproduce it, do you have some hint on how to do it?
>
> Maybe setting a zero queryid at the beginning of AutoVacWorkerMain() could fix
> the problem?

It turns out that the problem was simply that some process can inherit a
PgBackendStatus for which a previous backend reported a queryid. For processes
like autovacuum process, they will never report a new identifier so they
reported the previous one. Resetting the field like the other ones in
pgstat_bestart() fixes the problem for autovacuum and any similar process.

Attachment Content-Type Size
v1-0001-Additional-fixes-for-compute_query_id.patch text/x-diff 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-04-15 07:48:51 Re: [PATCH] expand the units that pg_size_pretty supports on output
Previous Message Masahiko Sawada 2021-04-15 07:42:47 Re: Replication slot stats misgivings