Skip to content
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

Register Citus secondaries in pg_dist_node #2755

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

CyberDem0n
Copy link
Collaborator

  1. All nodes with role == 'replica' and state == 'running' are are registered. In case is state isn't running the node is removed.
  2. In case of failover/switchover we always first update the primary
  3. When switching to a registered secondary we call citus_update_node() three times: rename primary to primary-demoted, put the primary name to a promoted secondary row and put the promoted secondary name to the primary row

State transitions are produced by the transition() method. First of all the method makes sure that the actual primary is registered in the metadata. In case if for a given group the primary didn't change, the method registers new secondaries and removes secondaries that are gone. It prefers to use citus_update_node() UDF to replace gone secondaries with added.

Communication protocol between primary nodes remains the same and all old features work without any changes.

1. All nodes with role == 'replica' and state == 'running' are
   are registered. In case is state isn't running the node is removed.
2. In case of failover/switchover we always first update the primary
3. When switching to a registered secondary we call citus_update_node()
   three times: rename primary to primary-demoted, put the primary name
   to a promoted secondary row and put the promoted secondary name to
   the primary row

State transitions are produced by the transition() method. First of all
the method makes sure that the actual primary is registered in the
metadata. In case if for a given group the primary didn't change, the
method registers new secondaries and removes secondaries that are gone.
It prefers to use citus_update_node() UDF to replace gone secondaries
with added.

Communication protocol between primary nodes remains the same and all
old features work without any changes.
@coveralls
Copy link

coveralls commented Jul 13, 2023

Pull Request Test Coverage Report for Build 8550930752

Details

  • 226 of 227 (99.56%) changed or added relevant lines in 15 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 99.863%

Changes Missing Coverage Covered Lines Changed/Added Lines %
patroni/psycopg.py 2 3 66.67%
Totals Coverage Status
Change from base Build 8523051901: 0.001%
Covered Lines: 13863
Relevant Lines: 13882

💛 - Coveralls

patroni/postgresql/citus.py Outdated Show resolved Hide resolved
Copy link
Contributor

@JelteF JelteF left a comment

Choose a reason for hiding this comment

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

not a full review yet, but some initial comments

patroni/postgresql/citus.py Outdated Show resolved Hide resolved
patroni/postgresql/citus.py Outdated Show resolved Hide resolved
patroni/postgresql/citus.py Outdated Show resolved Hide resolved
patroni/postgresql/citus.py Outdated Show resolved Hide resolved
patroni/postgresql/citus.py Outdated Show resolved Hide resolved
patroni/postgresql/citus.py Outdated Show resolved Hide resolved
patroni/postgresql/citus.py Outdated Show resolved Hide resolved
patroni/postgresql/citus.py Outdated Show resolved Hide resolved
patroni/postgresql/citus.py Outdated Show resolved Hide resolved
patroni/postgresql/citus.py Outdated Show resolved Hide resolved
@evemorgen
Copy link

Any clues when that could be released?

CyberDem0n and others added 7 commits April 2, 2024 15:02
and pass url with scheme to urllib3 to avoid warnings
Most of them are related to partially unknown types of values from empty
dict or list. To solve it for the empty dict we use `EMPTY_DICT` object of
newly introduced `_FrozenDict` class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

None yet

5 participants