Skip to content

Have drop node --force --destroy work as expected again#743

Merged
JelteF merged 9 commits intomasterfrom
drop-force-without-wait
Jul 2, 2021
Merged

Have drop node --force --destroy work as expected again#743
JelteF merged 9 commits intomasterfrom
drop-force-without-wait

Conversation

@JelteF
Copy link
Copy Markdown
Contributor

@JelteF JelteF commented Jun 28, 2021

The following command would get stuck for 30 seconds when the pg_autoctl service was still running.

pg_autoctl drop node --pgdata node1 --force --destroy

Copy link
Copy Markdown
Collaborator

@DimCitus DimCitus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs more comments... it's not obvious what your intention are in those code paths...

Comment thread src/bin/pg_autoctl/cli_drop_node.c Outdated
Comment thread src/bin/pg_autoctl/pidfile.c Outdated
Comment thread tests/pgautofailover_utils.py Outdated
"drop",
"node",
"--destroy",
"--force",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to change the way we run all of our test suite to use --force?

@DimCitus DimCitus added Developer productivity Enhancements to ability to ship quality code enhancement New feature or request Size: S Effort Estimate: Small labels Jun 28, 2021
@DimCitus DimCitus added this to the Sprint 2021 W26 W27 milestone Jun 28, 2021
@JelteF JelteF force-pushed the drop-force-without-wait branch 2 times, most recently from d587133 to 0a0ad4e Compare June 28, 2021 16:47
Comment thread src/bin/pg_autoctl/cli_drop_node.c Outdated
Comment on lines +588 to +591
* If --force is used, we skip the transition to "dropped". So a currently
* running process won't realise it's dropped, so it will not exit by
* itself. So there's no point in waiting for 30 seconds. Instead we
* manually kill it using SIGQUIT right away.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we bypass calling wait_for_pid_to_exit entirely in this case, then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's still nice to stop a currently running pg_autoctl process in this case. The first wait_for_pid_to_exit then simply becomes an easy way to check if there is a running process.

Comment thread src/bin/pg_autoctl/pidfile.c Outdated
@JelteF JelteF force-pushed the drop-force-without-wait branch 2 times, most recently from 8646e91 to 43af617 Compare June 30, 2021 12:32
Copy link
Copy Markdown
Collaborator

@DimCitus DimCitus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes. I think we only need a last pass of small changes!

Comment thread src/bin/pg_autoctl/cli_drop_node.c Outdated
Comment thread src/bin/pg_autoctl/cli_drop_node.c Outdated
}
else
{
if (!is_process_stopped(config->pathnames.pid, &stopped, &pid))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is_process_stopped is used a lot and often with a negation before it. I think it would be all easier if we had the function pidfile_process_is_running (similar to pg_setup_is_running and others).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is discussed over chat, flipping this brings in other consistency problems. Leaving it like this.

Comment thread src/bin/pg_autoctl/pidfile.c
@JelteF JelteF requested a review from DimCitus July 1, 2021 12:47
@JelteF JelteF enabled auto-merge (squash) July 1, 2021 12:50
@JelteF JelteF force-pushed the drop-force-without-wait branch from c7d708c to d446770 Compare July 2, 2021 09:05
@JelteF JelteF merged commit f665321 into master Jul 2, 2021
@DimCitus DimCitus deleted the drop-force-without-wait branch July 2, 2021 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Developer productivity Enhancements to ability to ship quality code enhancement New feature or request Size: S Effort Estimate: Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants