Skip to content

Add --if-not-exists flag to receive-wal #1065

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

crazybolillo
Copy link

This flag prevents receive-wal from exiting with an error when a slot with the same name already exists. This is the same behavior as calling pg_receivewal with the same flag.

References: #1049.

@crazybolillo crazybolillo requested a review from a team as a code owner February 9, 2025 00:34
@crazybolillo
Copy link
Author

I'm antonag32 but ended up doing this outside work hours so I'm using my personal account. Let me know if I have to make any changes.

Copy link
Contributor

@martinmarques martinmarques left a comment

Choose a reason for hiding this comment

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

There's missing documentation for this new option.
Not 100% sure of this, but maybe we want to think about adding this as an option to barman.conf as well,

@crazybolillo
Copy link
Author

Added the new flag to the RST docs.

barman/server.py Outdated
Comment on lines 2855 to 2859
args = "Replication slot '%s' already exists", self.config.slot_name
if ignore_duplicate:
output.info(*args)
else:
output.error(*args)
Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding the output message and how it's being set here. I would prefer a slightly different message when the user accepts the existing slot without failing than when it doesn't.

Also, follow the same process for calling the output module as in other parts of the code, meaning, don't pass a variable where you store the message string, but rather have the string be formatted when calling info() or error() methods.

Copy link
Author

Choose a reason for hiding this comment

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

Went ahead and changed the message so what happened is more clear to the user. Let me know what you think.

This flag prevents `receive-wal` from exiting with an error when
a slot with the same name already exists. This is the same behavior
as calling `pg_receivewal` with the same flag.

References: EnterpriseDB#1049.
@crazybolillo crazybolillo force-pushed the master branch 2 times, most recently from f96db2d to 70102b2 Compare March 6, 2025 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants