Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Replication slots #41

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

Merged
merged 6 commits into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix: primary_slot_name never actually was set
  • Loading branch information
zilder committed Mar 13, 2018
commit bc6c3027820017613f49a4d5522f8f5861fc298d
2 changes: 1 addition & 1 deletion testgres/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def spawn_replica(self, name=None, destroy=True, slot_name=None):

# Assign it a master and a recovery file (private magic)
node._assign_master(self.original_node)
node._create_recovery_conf(username=self.username)
node._create_recovery_conf(username=self.username, slot_name=slot_name)

return node

Expand Down
6 changes: 4 additions & 2 deletions testgres/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def _create_recovery_conf(self, username, slot_name=None):
).format(conninfo)

if slot_name:
line += "primary_slot_name={}\n".format()
line += "primary_slot_name={}\n".format(slot_name)

self.append_conf(RECOVERY_CONF_FILE, line)

Expand Down Expand Up @@ -872,7 +872,9 @@ def create_replication_slot(self, slot_name, dbname=None, username=None):
dbname: database name
username: database user name
"""
query = "select pg_create_physical_replication_slot('{}')".format(slot_name)
query = (
"select pg_create_physical_replication_slot('{}')"
).format(slot_name)

self.execute(query=query,
dbname=dbname or default_dbname(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't have to explicitly use default_dbname() and such since execute() method is able to handle None args properly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree

Expand Down