nickva commented on code in PR #5165:
URL: https://github.com/apache/couchdb/pull/5165#discussion_r1702393733
##########
src/couch/src/couch_lru.erl:
##########
@@ -53,14 +54,19 @@ close_int({Lru, DbName, Iter}, {Tree, Dict} = Cache) ->
true = ets:delete(CouchDbs, DbName),
true = ets:delete(CouchDbsPidToName, Pid),
exit(Pid, kill),
- {true, {gb_trees:delete(Lru, Tree), dict:erase(DbName,
Dict)}};
+ {true, {gb_trees:delete(Lru, Tree), maps:remove(DbName,
Dict)}};
false ->
true = couch_server:unlock(CouchDbs, DbName),
couch_stats:increment_counter([couchdb, couch_server,
lru_skip]),
- close_int(gb_trees:next(Iter), update(DbName, Cache))
+ NewCache = {NewTree, _} = update(DbName, Cache),
+ close_int(larger(Lru, NewTree), NewCache)
Review Comment:
This fixes trees getting out of sync, but gets us in another trouble:
non-termination. If all the entries are not idle, then we'd be bumping them up
as we see them. The `Lru` key would increase, for example, from 5 to 11, then
we see the key again 11, and we bump it again, now it's at say 13, we bump it
so on.
We'll have to figure something else out here. We've been discussing batching
the entries needing an update for after close_int returns perhaps....
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]