A cluster join never wipes a store that holds data (reckon-db#2) #3
Loading…
Reference in a new issue
No description provided.
Delete branch "neptunus/join-keeps-events"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs reckon-db-org/reckon-db#2 (the threat model and Done-when are in the issue; the data definition is in c7712). Step 1b of martha-ai/mcl-martha#1's LAN addendum.
What changes
join_existing_cluster/2, the one path every join takes (cold-start election, a found multi-member cluster,join_cluster/2), now checks the local store first. A store that holds data (any node under[streams]) refuses: the join answersrefused, an error names the store and the target, and the join is not retried. A store that cannot be counted does not join either (failed, retried).elect_coordinator/3ranks the nodes that hold data first, and names break ties. So the holder coordinates and an empty node joins it.Tests
reckon_db_cluster_join_keeps_events_SUITE(two real peers, cluster mode):higher_named_holder_keeps_its_events: B (higher name) holds 5 events and A is empty. They form one two-member cluster, and both nodes read all 5 events.both_holding_refuse_and_keep_their_events: both nodes hold events.join_cluster/1andjoin_cluster/2on B answerrefusedand the refusals are logged. Neither node joins and each keeps its own events. No further refusal is logged after a wait longer than a retry delay.reckon_db_store_coordinator_election_tests: holder-high, holder-low, both holding, none holding, and a holder among three nodes. Alsoclassify_stream_count,join_actionandjoin_decision. The existing election tests now call/3with no holders (/2was left with no caller).reckon_db_cluster_join_subscriptions_SUITE:pre_join_subscription_survives_joinno longer appends an event on the joiner before the join, because that join is now refused. Its subscription check is unchanged.Mutants (10, all killed; script
mutants.sh):main_coordinator(main's file): the suite goes red.drop_check: the suite goes red.held_joins: the unit tests and the suite go red.invert_check: the unit tests and the suite go red.unknown_empty: the unit tests go red.unknown_joins: the unit tests go red.no_ranking: the unit tests and the suite go red.no_self_holder: the suite goes red.no_remote_holder: the suite goes red.refused_retries: the suite goes red.