Skip to content

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 8 commits into from
Aug 8, 2019
Merged

Synchronous standbys #46

merged 8 commits into from
Aug 8, 2019

Conversation

zilder
Copy link
Collaborator

@zilder zilder commented May 31, 2018

What

A wrapper for synchronous_standby_names server option.

Usage

from testgres import get_new_node, First

master = get_new_node().init().start()
with master.replicate().start() as standby:
    master.append_conf("synchronous_commit = remote_apply")
    master.set_synchronous_standbys(First(1, [standby]))
    master.restart()

@funbringerfunbringer requested review from funbringer and ildus May 31, 2018 18:32
@codecov-io
Copy link

codecov-io commented Jun 1, 2018

Codecov Report

Merging #46 into master will increase coverage by 0.01%.
The diff coverage is 97.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #46      +/-   ##
==========================================
+ Coverage   97.12%   97.13%   +0.01%     
==========================================
  Files          17       18       +1     
  Lines        1529     1572      +43     
==========================================
+ Hits         1485     1527      +42     
- Misses         44       45       +1
Impacted FilesCoverage Δ
testgres/__init__.py100% <100%> (ø)⬆️
testgres/standby.py100% <100%> (ø)
tests/test_simple.py99.81% <100%> (ø)⬆️
testgres/node.py96.77% <90%> (-0.18%)⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 72d0373...24b0e57. Read the comment docs.

@@ -24,3 +24,7 @@
get_bin_path, \
get_pg_config, \
get_pg_version

from .standby import \
First, \
Copy link
Collaborator

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.

Copy link
Collaborator

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ildus I agree.

@funbringer
Copy link
Collaborator

I think we should replace First and Any with a Enum-based class.

@funbringer
Copy link
Collaborator

Now we could write

node.append_conf(synchronous_standby_names=First(1, [standby]))

self.standbys = standbys

def __str__(self):
return u"{} ({})".format(self.sync_num, u", ".join(
Copy link
Collaborator

Choose a reason for hiding this comment

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

тут мне кажется лучше добавить ключевое слово first, чтобы было явно

@@ -24,3 +24,7 @@
get_bin_path, \
get_pg_config, \
get_pg_version

from .standby import \
First, \
Copy link
Collaborator

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

@ildusildus merged commit 4c3e877 into postgrespro:master Aug 8, 2019
Sign up for free to join this conversation on . Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants