On 2024-02-13 11:30, torikoshia wrote:
> I'll update the patch including other points such as removing ensuring
> no page lock code.
Updated the patch.
> Using injection point support we should be able to add tests for
> testing pg_log_query_plan behaviour when there are page locks held or
> when auto_explain (with instrumentation) and pg_log_query_plan() work
> on the same query plan. Use injection point to make the backend
> running query wait at a suitable point to delay its execution and fire
> pg_log_query_plan() from other backend. May be the same test could
> examine the server log file to see if the plan is indeed output to the
> server log file.
Attached patch uses injection point as below:
- There may be more points to inject, but added an injection point at
ExecutorRun(), which seems to be the first interruption point where
plans can be reliably displayed.
- At injection point, it'd be possible to wait for some duration and
fire pg_log_plan_query() as you suggested. However, I'm not sure how
long duration is appropriate considering the variety of testing
environments. Instead, attached patch calls
HandleLogQueryPlanInterrupt() directly and set InterruptPending.
- Tests both pg_log_plan_query() and auto_explain logs for their output,
and the logged plans are the same.
--
Regards,
--
Atsushi Torikoshi
NTT DATA Group Corporation