pg_show_plans icon indicating copy to clipboard operation
pg_show_plans copied to clipboard

pg_show_plans_disable() is reset by each new backend startup (autovacum included)

Open legrandlegrand opened this issue 5 years ago • 0 comments

Hello, pg_show_plans_disable() effect, is disabled after each new backend startup inside pgsp_shmem_startup(), that sets pgsp->is_enable = true;

fix proposal:

	if (!found)
	{
		/* First time through ... */
#if PG_VERSION_NUM >= 90600
		pgsp->lock = &(GetNamedLWLockTranche("pg_show_plans"))->lock;
#else
		pgsp->lock = LWLockAssign();
#endif
		SpinLockInit(&pgsp->elock);
	}  <<< to move 
	/* Set the initial value to is_enable */
	pgsp->is_enable = true;
#if PG_VERSION_NUM >= 90500
	pgsp->plan_format = plan_format;
#endif


into

	if (!found)
	{
		/* First time through ... */
#if PG_VERSION_NUM >= 90600
		pgsp->lock = &(GetNamedLWLockTranche("pg_show_plans"))->lock;
#else
		pgsp->lock = LWLockAssign();
#endif
		SpinLockInit(&pgsp->elock);

	/* Set the initial value to is_enable */
	pgsp->is_enable = true;
#if PG_VERSION_NUM >= 90500
	pgsp->plan_format = plan_format;
#endif
	 }  <<< moved

regards PAscal

legrandlegrand avatar Apr 25 '20 20:04 legrandlegrand