Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start Disabled GUC Option #4

Closed
kmoppel opened this issue Apr 3, 2020 · 3 comments
Closed

Start Disabled GUC Option #4

kmoppel opened this issue Apr 3, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@kmoppel
Copy link
Contributor

kmoppel commented Apr 3, 2020

As such troubleshooting / debugging is not always used and has a small performance impact, would be nice if the extension could start in disabled mode and one could enable it when the need arises with pg_show_plans_enable().
An alternative is of course to disable the extension from "shared_preload_libraries", but this requires server restart which might not work for all.

@legrandlegrand
Copy link

Hello,
Here is a patch trying to answer this question by adding pg_show_plans.startup_enable GUC:

pg_show_plans.startup_enable.diff.txt

or
legrandlegrand#1

@kovmir kovmir added the enhancement New feature or request label Jan 24, 2023
@kovmir
Copy link
Collaborator

kovmir commented Jan 24, 2023

Hello! I am the new maintainer.

It seems like currently we have a redundant variable, and none of the two give the desired functionality, i.e.:

static void
pgsp_ExecutorEnd(QueryDesc *queryDesc)
{
	/* Bypass the following steps if this pgsp_enable is set to false  */
	if (pgsp_enable)
	{
		/* Delete entry */
		SpinLockAcquire(&pgsp->elock);
		if (pgsp->is_enable)
		{
			SpinLockRelease(&pgsp->elock);
			delete_entry(MyProcPid);
		}
		else
			SpinLockRelease(&pgsp->elock);
	}

	if (prev_ExecutorEnd)
		prev_ExecutorEnd(queryDesc);
	else
		standard_ExecutorEnd(queryDesc);
}

The execution occurs iff both *_enable variables are set to true. I just cannot find the difference it makes having those two in the different states.

I will try to refactor this functionality a little bit.

@kovmir kovmir changed the title Add somekind of option to start disabled Start Disabled GUC Option Jan 26, 2023
@kovmir kovmir self-assigned this Jan 26, 2023
@kovmir kovmir closed this as completed in 9efaf38 Jan 26, 2023
@kovmir
Copy link
Collaborator

kovmir commented Jan 26, 2023

Alright, I got it. GUC variable disables the extension locally, and shared structure variable disables the extension globally (for all clients).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants