Skip to content

[#249] Fix of port number leak in NodeBackup::spawn_replica #250

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

Conversation

dmitry-lipetsk
Copy link
Collaborator

@dmitry-lipetsk dmitry-lipetsk commented May 4, 2025

This patch has the following changes:

  1. It adds a new argument release_resources to PostgresNode::cleanup method. Default value is False.

  2. It fixes a port number leak in NodeBackup::spawn_replica through explicit call of PostgresNode::cleanup(release_resources=True).

Closes #249.

We must release a port number after the shutdown and cleanup operation not before.

It is a part of work for postgrespro#249
This private method releases all the allocated node resources (port and so on).

PostgresNode::__exit__ calls this new method instead free_port.
…is added

When this argument is True, cleanup calls _release_resources method.

Default value is False.
…ed port number during failure

NodeBackup::spawn_replica uses an explict "rollback" code to destroy a newly allocated node to release a reserved port number.
@dmitry-lipetsk dmitry-lipetsk merged commit c3b25b2 into postgrespro:master May 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant