@@ -319,23 +319,19 @@ schema() ->
319319populate_ets_from_shu (TblName , ShuState ) ->
320320 shu :fold (
321321 fun (Key , _Acc ) ->
322- case shu :read_all (ShuState , Key ) of
323- {ok , Fields } when is_map (Fields ), map_size (Fields ) > 0 ->
324- CT = maps :get (current_term , Fields , undefined ),
325- Node = maps :get (voted_for_node , Fields , undefined ),
326- ServerNameBin = maps :get (voted_for_name , Fields , undefined ),
327- ServerName = case ServerNameBin of
328- undefined -> undefined ;
329- B when is_binary (B ) -> binary_to_atom (B , utf8 );
330- _ -> ServerNameBin
331- end ,
332- VF = encode_voted_for (Node , ServerName ),
333- LA = maps :get (last_applied , Fields , undefined ),
334- ? DEBUG (" ra_log_meta: recovered from shu - Key=~p , CT=~p , VF=~p , LA=~p " , [Key , CT , VF , LA ]),
335- ets :insert (TblName , {Key , CT , VF , LA });
336- _ ->
337- ok
338- end ,
322+ {ok , Fields } = shu :read_all (ShuState , Key ),
323+ CT = maps :get (current_term , Fields , undefined ),
324+ Node = maps :get (voted_for_node , Fields , undefined ),
325+ ServerNameBin = maps :get (voted_for_name , Fields , undefined ),
326+ ServerName = case ServerNameBin of
327+ undefined -> undefined ;
328+ B when is_binary (B ) -> binary_to_atom (B , utf8 );
329+ _ -> ServerNameBin
330+ end ,
331+ VF = encode_voted_for (Node , ServerName ),
332+ LA = maps :get (last_applied , Fields , undefined ),
333+ ? DEBUG (" ra_log_meta: recovered from shu - Key=~p , CT=~p , VF=~p , LA=~p " , [Key , CT , VF , LA ]),
334+ ets :insert (TblName , {Key , CT , VF , LA }),
339335 _Acc
340336 end ,
341337 ok ,
0 commit comments