WIP: refactoring inner handling, but ... (more)
There are a couple of weird things in the snippet below (AP mode): 22:32:58.209 b uses inner: [{epoch,136},{author,c},{mode,ap_mode},{witnesses,[]},{upi,[b,c]},{repair,[]},{down,[a]},{flap,undefined},{d,[d_foo1,{ps,[{a,b}]},{nodes_up,[b,c]}]},{d2,[]}] (outer flap epoch 136: {flap_i,{{{epk,115},{1439,904777,11627}},28},[a,{a,problem_with,b},{b,problem_with,a}],[{a,{{{epk,126},{1439,904777,149865}},16}},{b,{{{epk,115},{1439,904777,11627}},28}},{c,{{{epk,121},{1439,904777,134392}},15}}]}) (my flap {{epk,115},{1439,904777,11627}} 29 [{a,{{{epk,126},{1439,904777,149865}},28}},{b,{{{epk,115},{1439,904777,11627}},29}},{c,{{{epk,121},{1439,904777,134392}},26}}]) 22:32:58.224 c uses inner: [{epoch,136},{author,c},{mode,ap_mode},{witnesses,[]},{upi,[b,c]},{repair,[]},{down,[a]},{flap,undefined},{d,[d_foo1,{ps,[{a,b}]},{nodes_up,[b,c]}]},{d2,[]}] (outer flap epoch 136: {flap_i,{{{epk,115},{1439,904777,11627}},28},[a,{a,problem_with,b},{b,problem_with,a}],[{a,{{{epk,126},{1439,904777,149865}},16}},{b,{{{epk,115},{1439,904777,11627}},28}},{c,{{{epk,121},{1439,904777,134392}},15}}]}) (my flap {{epk,121},{1439,904777,134392}} 28 [{a,{{{epk,126},{1439,904777,149865}},28}},{b,{{{epk,115},{1439,904777,11627}},28}},{c,{{{epk,121},{1439,904777,134392}},28}}]) CONFIRM by epoch inner 136 <<103,64,252,...>> at [b,c] [] Priv1 [{a,{{132,<<"Cï|ÿzKX:Á"...>>},[a],[c],[b],[],false}}, {b,{{127,<<185,139,3,2,96,189,...>>},[b,c],[],[a],[],false}}, {c,{{133,<<145,71,223,6,177,...>>},[b,c],[a],[],[],false}}] agree false Pubs: [{a,136},{b,136},{c,136}] DoIt, 1. Both the "uses inner" messages and also the "CONFIRM by epoch inner 136" show that B & C are using the same inner projection. However, the 'Priv1' output shows b & c on different epochs, 127 & 133. Weird. 2. I've added an infinite loop, probably in this commit. :-(
This commit is contained in:
parent
9bf0eedb64
commit
a71e9543fe
1 changed files with 83 additions and 75 deletions
|
@ -1299,83 +1299,90 @@ a30_make_inner_projection(P_current, P_newprop3, P_latest, Up,
|
||||||
down=P_i2#projection_v1.all_members
|
down=P_i2#projection_v1.all_members
|
||||||
-- [MyName]}
|
-- [MyName]}
|
||||||
end,
|
end,
|
||||||
FinalInnerEpoch =
|
#projection_v1{epoch_number=Epoch_p_inner,
|
||||||
case inner_projection_exists(P_current) of
|
upi=UPI_p_inner,
|
||||||
false ->
|
repairing=Repairing_p_inner} = P_inner,
|
||||||
FinalCreation = P_newprop3#projection_v1.creation_time,
|
LatestHasCompatibleInner =
|
||||||
AllFlapCounts_epk =
|
case inner_projection_exists(P_latest) of
|
||||||
[Epk || {{Epk,_FlTime}, _FlCount} <-
|
|
||||||
get_all_flap_counts(P_newprop3)],
|
|
||||||
case AllFlapCounts_epk of
|
|
||||||
[] ->
|
|
||||||
P_newprop3#projection_v1.epoch_number;
|
|
||||||
[_|_] ->
|
|
||||||
lists:max(AllFlapCounts_epk)
|
|
||||||
end;
|
|
||||||
true ->
|
true ->
|
||||||
P_oldinner = inner_projection_or_self(P_current),
|
P_latest_i = inner_projection_or_self(P_latest),
|
||||||
if P_oldinner#projection_v1.upi ==
|
#projection_v1{epoch_number=Epoch_latest_i,
|
||||||
P_inner#projection_v1.upi
|
upi=UPI_latest_i,
|
||||||
andalso
|
repairing=Repairing_latest_i} = P_latest_i,
|
||||||
P_oldinner#projection_v1.repairing ==
|
?REACT({a30, ?LINE, [{epoch_latest_i, Epoch_latest_i},
|
||||||
P_inner#projection_v1.repairing
|
{upi_latest_i, UPI_latest_i},
|
||||||
andalso
|
{repairing_latest_i}]}),
|
||||||
P_oldinner#projection_v1.down ==
|
%io:format(user, "INNER: ~p line ~p ~p\n", [{epoch_latest_i, Epoch_latest_i}, {epoch_final_inner, FinalInnerEpoch}, {upi_latest_i, UPI_latest_i}, {repairing_latest_i}]),
|
||||||
P_inner#projection_v1.down ->
|
if %% TODO yo delete? Epoch_latest_i > FinalInnerEpoch
|
||||||
FinalCreation = P_oldinner#projection_v1.creation_time,
|
%% TODO yo delete? andalso
|
||||||
P_oldinner#projection_v1.epoch_number;
|
UPI_p_inner == UPI_latest_i
|
||||||
true ->
|
andalso
|
||||||
FinalCreation = P_newprop3#projection_v1.creation_time,
|
Repairing_p_inner == Repairing_latest_i ->
|
||||||
P_oldinner#projection_v1.epoch_number + 1
|
%% Use latest's inner projection instead!
|
||||||
end
|
?REACT({a30, ?LINE, []}),
|
||||||
|
%io:format(user, "INNER: ~p line ~p\n", [MyName, ?LINE]),
|
||||||
|
machi_projection:update_checksum(
|
||||||
|
P_inner#projection_v1{inner=P_latest_i});
|
||||||
|
true ->
|
||||||
|
?REACT({a30, ?LINE, []}),
|
||||||
|
false
|
||||||
|
end;
|
||||||
|
false ->
|
||||||
|
?REACT({a30, ?LINE, []}),
|
||||||
|
false
|
||||||
end,
|
end,
|
||||||
|
if LatestHasCompatibleInner /= false ->
|
||||||
%% TODO: When we implement the real chain repair function, we
|
{LatestHasCompatibleInner, S_i};
|
||||||
%% need to keep in mind that an inner projection with
|
true ->
|
||||||
%% up nodes > 1, repair is required there! In the
|
FinalInnerEpoch =
|
||||||
%% current simulator, repair is not simulated and
|
case inner_projection_exists(P_current) of
|
||||||
%% finished (and then growing the UPI list). Fix.
|
false ->
|
||||||
P_inner2 = machi_projection:update_checksum(
|
?REACT({a30xyzxyz, ?LINE, [P_newprop3#projection_v1.epoch_number]}),
|
||||||
P_inner#projection_v1{epoch_number=FinalInnerEpoch,
|
FinalCreation = P_newprop3#projection_v1.creation_time,
|
||||||
creation_time=FinalCreation}),
|
P_newprop3#projection_v1.epoch_number;
|
||||||
?REACT({a30, ?LINE, [{inner_summary,
|
%% AllFlapCounts_epk =
|
||||||
machi_projection:make_summary(P_inner2)}]}),
|
%% [Epk || {{Epk,_FlTime}, _FlCount} <-
|
||||||
%% Put it all together.
|
%% get_all_flap_counts(P_newprop3)],
|
||||||
P_newprop4 = machi_projection:update_checksum(
|
%% case AllFlapCounts_epk of
|
||||||
P_newprop3#projection_v1{inner=P_inner2}),
|
%% [] ->
|
||||||
#projection_v1{epoch_number=Epoch_i4,
|
%% ?REACT({a30xyzxyz, ?LINE, [P_newprop3#projection_v1.epoch_number]}),
|
||||||
upi=UPI_i4,
|
%% P_newprop3#projection_v1.epoch_number;
|
||||||
repairing=Repairing_i4} = P_newprop4,
|
%% [_|_] ->
|
||||||
case inner_projection_exists(P_latest) of
|
%% ?REACT({a30xyzxyz, ?LINE, [AllFlapCounts_epk]}),
|
||||||
true ->
|
%% lists:max(AllFlapCounts_epk)
|
||||||
P_latest_i = inner_projection_or_self(P_latest),
|
%% end;
|
||||||
#projection_v1{epoch_number=Epoch_latest_i,
|
true ->
|
||||||
upi=UPI_latest_i,
|
P_oldinner = inner_projection_or_self(P_current),
|
||||||
repairing=Repairing_latest_i} = P_latest_i,
|
if P_oldinner#projection_v1.upi ==
|
||||||
?REACT({a30, ?LINE, [{epoch_latest_i, Epoch_latest_i},
|
P_inner#projection_v1.upi
|
||||||
{epoch_final_inner, FinalInnerEpoch},
|
andalso
|
||||||
{upi_latest_i, UPI_latest_i},
|
P_oldinner#projection_v1.repairing ==
|
||||||
{repairing_latest_i}]}),
|
P_inner#projection_v1.repairing
|
||||||
%io:format(user, "INNER: ~p line ~p ~p\n", [{epoch_latest_i, Epoch_latest_i}, {epoch_final_inner, FinalInnerEpoch}, {upi_latest_i, UPI_latest_i}, {repairing_latest_i}]),
|
andalso
|
||||||
if Epoch_latest_i > FinalInnerEpoch
|
P_oldinner#projection_v1.down ==
|
||||||
andalso
|
P_inner#projection_v1.down ->
|
||||||
UPI_i4 == UPI_latest_i
|
?REACT({a30xyzxyz, ?LINE, [P_oldinner#projection_v1.epoch_number]}),
|
||||||
andalso
|
FinalCreation = P_oldinner#projection_v1.creation_time,
|
||||||
Repairing_i4 == Repairing_latest_i ->
|
P_oldinner#projection_v1.epoch_number;
|
||||||
%% Use latest's inner projection instead!
|
true ->
|
||||||
?REACT({a30, ?LINE, []}),
|
?REACT({a30xyzxyz, ?LINE, [P_oldinner#projection_v1.epoch_number + 1]}),
|
||||||
%io:format(user, "INNER: ~p line ~p\n", [MyName, ?LINE]),
|
FinalCreation = P_newprop3#projection_v1.creation_time,
|
||||||
P_newprop5 = machi_projection:update_checksum(
|
P_oldinner#projection_v1.epoch_number + 1
|
||||||
P_newprop4#projection_v1{inner=P_latest_i}),
|
end
|
||||||
{P_newprop5, S_i};
|
end,
|
||||||
true ->
|
%% TODO: When we implement the real chain repair function, we
|
||||||
?REACT({a30, ?LINE, []}),
|
%% need to keep in mind that an inner projection with
|
||||||
%io:format(user, "INNER: ~p line ~p\n", [MyName, ?LINE]),
|
%% up nodes > 1, repair is required there! In the
|
||||||
{P_newprop4, S_i}
|
%% current simulator, repair is not simulated and
|
||||||
end;
|
%% finished (and then growing the UPI list). Fix.
|
||||||
false ->
|
P_inner2 = machi_projection:update_checksum(
|
||||||
?REACT({a30, ?LINE, []}),
|
P_inner#projection_v1{epoch_number=FinalInnerEpoch,
|
||||||
%io:format(user, "INNER: ~p line ~p\n", [MyName, ?LINE]),
|
creation_time=FinalCreation}),
|
||||||
|
?REACT({a30, ?LINE, [{inner_summary,
|
||||||
|
machi_projection:make_summary(P_inner2)}]}),
|
||||||
|
%% Put it all together.
|
||||||
|
P_newprop4 = machi_projection:update_checksum(
|
||||||
|
P_newprop3#projection_v1{inner=P_inner2}),
|
||||||
{P_newprop4, S_i}
|
{P_newprop4, S_i}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -1527,6 +1534,7 @@ react_to_env_A50(P_latest, FinalProps, #ch_mgr{proj=P_current}=S) ->
|
||||||
?REACT({a50, ?LINE, [{current_epoch, P_current#projection_v1.epoch_number},
|
?REACT({a50, ?LINE, [{current_epoch, P_current#projection_v1.epoch_number},
|
||||||
{latest_epoch, P_latest#projection_v1.epoch_number},
|
{latest_epoch, P_latest#projection_v1.epoch_number},
|
||||||
{final_props, FinalProps}]}),
|
{final_props, FinalProps}]}),
|
||||||
|
%% if S#ch_mgr.name == b; S#ch_mgr.name == c -> io:format(user, "A50: ~p: ~p\n", [S#ch_mgr.name, get(react)]); true -> ok end,
|
||||||
{{no_change, FinalProps, P_current#projection_v1.epoch_number}, S}.
|
{{no_change, FinalProps, P_current#projection_v1.epoch_number}, S}.
|
||||||
|
|
||||||
react_to_env_B10(Retries, P_newprop, P_latest, LatestUnanimousP,
|
react_to_env_B10(Retries, P_newprop, P_latest, LatestUnanimousP,
|
||||||
|
|
Loading…
Reference in a new issue