You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2017/07/11 23:25:49 UTC
[couchdb] 02/02: FIXUP: Move invalidation to ddoc_cache_entry
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to branch optimize-ddoc-cache
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 3aa1e0a69eefee85007bec9c914271eb886717b8
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Tue Jul 11 18:25:39 2017 -0500
FIXUP: Move invalidation to ddoc_cache_entry
---
src/ddoc_cache/src/ddoc_cache_entry.erl | 4 ++++
src/ddoc_cache/src/ddoc_cache_lru.erl | 5 -----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/ddoc_cache/src/ddoc_cache_entry.erl b/src/ddoc_cache/src/ddoc_cache_entry.erl
index 0025904..85108e7 100644
--- a/src/ddoc_cache/src/ddoc_cache_entry.erl
+++ b/src/ddoc_cache/src/ddoc_cache_entry.erl
@@ -196,6 +196,10 @@ handle_cast(force_refresh, St) ->
NewSt = if St#st.accessed > 0 -> St; true ->
St#st{accessed = 1}
end,
+ % We remove the cache entry value so that any
+ % new client comes to us for the refreshed
+ % value.
+ true = ets:update_element(?CACHE, St#st.key, {#entry.value, undefined}),
handle_cast(refresh, NewSt);
handle_cast(refresh, #st{accessed = 0} = St) ->
diff --git a/src/ddoc_cache/src/ddoc_cache_lru.erl b/src/ddoc_cache/src/ddoc_cache_lru.erl
index 2d8a371..82d7245 100644
--- a/src/ddoc_cache/src/ddoc_cache_lru.erl
+++ b/src/ddoc_cache/src/ddoc_cache_lru.erl
@@ -178,11 +178,6 @@ handle_cast({do_refresh, DbName, DDocIdList}, St) ->
case khash:lookup(DDocIds, DDocId) of
{value, Keys} ->
khash:fold(Keys, fun(Key, Pid, _) ->
- % We're erasing the value from cache here
- % so that new clients will wait for the
- % refresh to complete.
- Op = [{#entry.val, undefined}],
- true = ets:update_element(?CACHE, Key, Op),
ddoc_cache_entry:refresh(Pid)
end, nil);
not_found ->
--
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.