Alter ordering

don't try the cache hit before checking for presence, only look in the
cache if protecting a lookup from the persisted part
This commit is contained in:
martinsumner 2016-12-24 18:13:55 +00:00
parent 480820e466
commit 6e5f5d2d44

View file

@ -230,17 +230,17 @@ fetch(LedgerKey, Hash, State) ->
{not_present, summary_bloom, null}; {not_present, summary_bloom, null};
true -> true ->
Slot = lookup_slot(LedgerKey, Summary#summary.index), Slot = lookup_slot(LedgerKey, Summary#summary.index),
SlotBloom = Slot#slot_index_value.bloom,
case is_check_slot_required({hash, Hash}, SlotBloom) of
false ->
{not_present, slot_bloom, null};
true ->
CacheEntry = array:get(Slot#slot_index_value.slot_id, CacheEntry = array:get(Slot#slot_index_value.slot_id,
State#state.cache), State#state.cache),
case CacheEntry of case CacheEntry of
{LedgerKey, CachedValue} -> {LedgerKey, CachedValue} ->
{{LedgerKey, CachedValue}, cache_entry, null}; {{LedgerKey, CachedValue}, cache_entry, null};
_ -> _ ->
SlotBloom = Slot#slot_index_value.bloom,
case is_check_slot_required({hash, Hash}, SlotBloom) of
false ->
{not_present, slot_bloom, null};
true ->
SlotLook = lookup_in_slot(LedgerKey, SlotLook = lookup_in_slot(LedgerKey,
{pointer, {pointer,
State#state.handle, State#state.handle,