RE: Terminate the idle sessions

Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>

From: "kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>
To: 'Li Japin' <japinli@hotmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, Thomas Munro <thomas.munro@gmail.com>, "bharath.rupireddyforpostgres@gmail.com" <bharath.rupireddyforpostgres@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2020-11-16T05:22:35Z
Lists: pgsql-hackers
Dear Li,

> Thanks for your advice! Attached v4.

I confirmed it. OK.

> @@ -30,6 +30,7 @@ typedef enum TimeoutId
>  	STANDBY_DEADLOCK_TIMEOUT,
>  	STANDBY_TIMEOUT,
>  	STANDBY_LOCK_TIMEOUT,
> +	IDLE_SESSION_TIMEOUT,
>  	IDLE_IN_TRANSACTION_SESSION_TIMEOUT,
>  	/* First user-definable timeout reason */
>  	USER_TIMEOUT,

I'm not familiar with timeout, but I can see that the priority of idle-session is set lower than transaction-timeout.
Could you explain the reason? In my image this timeout locates at the lowest layer, so it might have the lowest 
priority.

Other codes are still checked :-(.

Hayato Kuroda
FUJITSU LIMITED

Commits

  1. Rethink SQLSTATE code for ERRCODE_IDLE_SESSION_TIMEOUT.

  2. Improve commentary in timeout.c.

  3. Add idle_session_timeout.

  4. Improve timeout.c's handling of repeated timeout set/cancel.