Fallback - #43
Merged
Merged
Conversation
There was a problem hiding this comment.
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/1wrapper that attemptserpcand 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.
There was a problem hiding this comment.
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() ->
thalesmg
approved these changes
Aug 3, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implement a mechanism that allows classy to join nodes that don't run classy yet. This mechanism is meant to support rolling upgrades.