Skip to content

Fallback - #43

Merged
ieQu1 merged 5 commits into
masterfrom
dev/fallback
Aug 3, 2026
Merged

Fallback#43
ieQu1 merged 5 commits into
masterfrom
dev/fallback

Conversation

@ieQu1

@ieQu1 ieQu1 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Implement a mechanism that allows classy to join nodes that don't run classy yet. This mechanism is meant to support rolling upgrades.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a fallback-based bootstrapping path so a classy-aware node can join a node that does not run classy yet (to support rolling upgrades), and adjusts vote restoration to occur on run-level transition rather than supervisor start.

Changes:

  • Introduces exported fallback hook registration APIs (fallback_get_site/1, fallback_get_cluster/1, fallback_get_meta/2, fallback_get_peer_nodes/1) and hookpoint macros.
  • Adds a classy_node:hello/1 wrapper that attempts erpc and falls back to hook-derived bootstrap info for non-classy nodes.
  • Moves vote restoration to a run-level hook and adjusts supervisor startup ordering accordingly.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/classy.erl Exposes fallback hook registration APIs and documents fallback behavior.
src/classy_vote.erl Adds on_run_level/2 to restore votes during run-level transition.
src/classy_sup.erl Removes restore calls from supervisor start and reorders children to align with new restore timing.
src/classy_node.erl Implements hello/1 with fallback path for joining non-classy nodes.
src/classy_membership.erl Adds membership “fallback” sync-data builder used by the join fallback flow.
src/classy_internal.hrl Adds hookpoint macros for the new fallback hookpoints.
src/classy_hook.erl Registers the vote-restore run-level hook during hook initialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/classy_node.erl Outdated
Comment thread src/classy_node.erl
Comment thread src/classy_node.erl
Comment thread src/classy.erl Outdated
Comment thread src/classy_membership.erl Outdated
Comment thread src/classy_membership.erl Outdated
@ieQu1
ieQu1 marked this pull request as ready for review August 3, 2026 16:38
@ieQu1
ieQu1 requested a review from Copilot August 3, 2026 16:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

src/classy_node.erl:445

  • Only checking that PeerNodes is a list can allow non-node elements through; those will later be passed to fallback hooks and to site_info_fallback/1, potentially causing confusing failures inside hooks. Validate that the list contains only node() values (atoms) before proceeding.
        BootstrapNodeInfo = site_info_fallback(Node),
        {ok, Node, Site, Cluster, _SiteMeta} ?= BootstrapNodeInfo,
        {ok, PeerNodes} ?= classy_hook:first_match(?fallback_get_peer_nodes, [Node]),
        true ?= is_list(PeerNodes) orelse {error, {bad_peer_nodes, PeerNodes}},
        PeerInfo = [BootstrapNodeInfo | [site_info_fallback(I) || I <- PeerNodes, I =/= Node]],

src/classy_membership.erl:325

  • dump_values/0 is exported but has no -spec, while nearby exported helpers (e.g., dump/0) are typed. Adding a spec helps Dialyzer and clarifies the return shape for tests/debugging.
-doc """
Format values stored in the membership CRDT to a human-readable form for tests and debugging.

Unlike @code{dump/0},
this function doesn't return internal metadata related to synchronization.
""".
dump_values() ->

Comment thread src/classy_node.erl
@ieQu1
ieQu1 merged commit 1b317c5 into master Aug 3, 2026
5 checks passed
@zmstone
zmstone deleted the dev/fallback branch August 3, 2026 18:16
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.

3 participants