r2dbc-pool icon indicating copy to clipboard operation
r2dbc-pool copied to clipboard

validation query(SELECT 1) alway execute

Open zhuangzibin opened this issue 1 year ago • 2 comments

Bug Report

The issue is that validation query (SELECT 1) is triggerred at regular intervals when the application is started and these connection remains in idle status forever.

Versions

  • Driver:1.0.1
  • Database:pgsql
  • Java:17
  • OS:mac

zhuangzibin avatar Jan 21 '25 08:01 zhuangzibin

Pool config defaults to local validation (i.e. whether the connection is connected to a server). Remote validation (ConnectionPoolConfiguration.Builder#validationDepth(REMOTE)) enables SELECT 1 validation queries.

Not quite sure what you're asking for. If you're seeing issues with connection starvation, you might want to update to Pool 1.0.2 and the latest Postgres driver.

mp911de avatar Jan 21 '25 09:01 mp911de

I think this check (select 1) is used to determine whether the thread is alive, rather than executing it (sql) every time before executing the statement.I think we should start a scheduled daemon thread to perform this check (select 1)

zhuangzibin avatar Jan 23 '25 08:01 zhuangzibin