- Notifications
You must be signed in to change notification settings - Fork 35
Synchronous standbys #46
New issue
Have a question about this project? Sign up for a free account to open an issue and contact its maintainers and the community.
By clicking “Sign up for ”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on ? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commitsSelect commit Hold shift + click to select a range
60936c5
Add set_synchronous_standbys() method
zilder60b2b1c
Add set_synchronous_standbys() method
zilder45c8378
fix formatting, make standby.First and standby.Any classes available …
zilder4a78635
Merge branch 'syncrep' of .com:zilder/testgres into syncrep
zilder0819053
fix formatting
zildera1fcfac
fix test_synchronous_replication so it could pass on all supported ve…
zilder6fb7a70
Merge branch 'master' into syncrep
zilder24b0e57
Merge branch 'master' into syncrep
zilderFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -24,3 +24,7 @@ | ||
get_bin_path, \ | ||
get_pg_config, \ | ||
get_pg_version | ||
from .standby import \ | ||
First, \ | ||
Any |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# coding: utf-8 | ||
import six | ||
@six.python_2_unicode_compatible | ||
class First: | ||
""" | ||
Specifies a priority-based synchronous replication and makes transaction | ||
commits wait until their WAL records are replicated to ``num_sync`` | ||
synchronous standbys chosen based on their priorities. | ||
Args: | ||
sync_num (int): the number of standbys that transaction need to wait | ||
for replies from | ||
standbys (:obj:`list` of :class:`.PostgresNode`): the list of standby | ||
nodes | ||
""" | ||
def __init__(self, sync_num, standbys): | ||
self.sync_num = sync_num | ||
self.standbys = standbys | ||
def __str__(self): | ||
return u"{} ({})".format(self.sync_num, u", ".join( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. тут мне кажется лучше добавить ключевое слово first, чтобы было явно | ||
u"\"{}\"".format(r.name) for r in self.standbys)) | ||
@six.python_2_unicode_compatible | ||
class Any: | ||
""" | ||
Specifies a quorum-based synchronous replication and makes transaction | ||
commits wait until their WAL records are replicated to at least ``num_sync`` | ||
listed standbys. Only available for Postgres 10 and newer. | ||
Args: | ||
sync_num (int): the number of standbys that transaction need to wait | ||
for replies from | ||
standbys (:obj:`list` of :class:`.PostgresNode`): the list of standby | ||
nodes | ||
""" | ||
def __init__(self, sync_num, standbys): | ||
self.sync_num = sync_num | ||
self.standbys = standbys | ||
def __str__(self): | ||
return u"ANY {} ({})".format(self.sync_num, u", ".join( | ||
u"\"{}\"".format(r.name) for r in self.standbys)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO those names are too generic to be exported at top level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think names are ok but should be used with the of module, like
standby.First
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ildus I agree.