33bfbe109e
* Set max length of a chain at -define(MAX_CHAIN_LENGTH, 64). * Perturb tick sleep time of each manager * If a chain manager L has zero members in its chain, and then its local public projection store (authored by some remote author R) has a projection that contains L, then adopt R's projection and start humming consensus. * Handle "cross-talk" across projection stores, when chain membership is changed administratively, e.g. chain was [a,b,c] then changed to merely [a], but that change only happens on a. Servers b & c continue to use stale projections and scribble their projection suggestions to a, causing it to flap. What's really cool about the flapping handling is that it *works*. I wasn't thinking about this scenario when designing the flapping logic, but it's really nifty that this extra scenario causes a to flap and then a's inner projection remains stable, yay! * Add complaints when "cross-talk" is observed. * Fix flapping sleep time throttle. * Fix bug in the machi_projection_store.erl's bookkeeping of the max epoch number when flapping.
65 lines
2.4 KiB
Erlang
65 lines
2.4 KiB
Erlang
%% -------------------------------------------------------------------
|
|
%%
|
|
%% Copyright (c) 2007-2014 Basho Technologies, Inc. All Rights Reserved.
|
|
%%
|
|
%% This file is provided to you under the Apache License,
|
|
%% Version 2.0 (the "License"); you may not use this file
|
|
%% except in compliance with the License. You may obtain
|
|
%% a copy of the License at
|
|
%%
|
|
%% http://www.apache.org/licenses/LICENSE-2.0
|
|
%%
|
|
%% Unless required by applicable law or agreed to in writing,
|
|
%% software distributed under the License is distributed on an
|
|
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
%% KIND, either express or implied. See the License for the
|
|
%% specific language governing permissions and limitations
|
|
%% under the License.
|
|
%%
|
|
%% -------------------------------------------------------------------
|
|
|
|
-ifndef(MACHI_PROJECTION_HRL).
|
|
-define(MACHI_PROJECTION_HRL, true).
|
|
|
|
-type pv1_csum() :: binary().
|
|
-type pv1_epoch() :: {pv1_epoch_n(), pv1_csum()}.
|
|
-type pv1_epoch_n() :: non_neg_integer().
|
|
-type pv1_server() :: atom() | binary().
|
|
-type pv1_timestamp() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}.
|
|
|
|
-record(p_srvr, {
|
|
name :: pv1_server(),
|
|
proto = 'ipv4' :: 'ipv4' | 'disterl', % disterl? Hrm.
|
|
address :: term(), % Protocol-specific
|
|
port :: term(), % Protocol-specific
|
|
props = [] :: list() % proplist for other related info
|
|
}).
|
|
|
|
-type p_srvr() :: #p_srvr{}.
|
|
-type p_srvr_dict() :: orddict:orddict().
|
|
|
|
-define(DUMMY_PV1_EPOCH, {0,<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>}).
|
|
|
|
-record(projection_v1, {
|
|
epoch_number :: pv1_epoch_n(),
|
|
epoch_csum :: pv1_csum(),
|
|
author_server :: pv1_server(),
|
|
all_members :: [pv1_server()],
|
|
creation_time :: pv1_timestamp(),
|
|
upi :: [pv1_server()],
|
|
repairing :: [pv1_server()],
|
|
down :: [pv1_server()],
|
|
dbg :: list(), %proplist(), is checksummed
|
|
dbg2 :: list(), %proplist(), is not checksummed
|
|
members_dict :: p_srvr_dict()
|
|
}).
|
|
|
|
-define(MACHI_DEFAULT_TCP_PORT, 50000).
|
|
|
|
-define(SHA_MAX, (1 bsl (20*8))).
|
|
|
|
%% Set a limit to the maximum chain length, so that it's easier to
|
|
%% create a consistent projection ranking score.
|
|
-define(MAX_CHAIN_LENGTH, 64).
|
|
|
|
-endif. % !MACHI_PROJECTION_HRL
|