Github user dhutchis commented on the pull request:
https://github.com/apache/accumulo/pull/96#issuecomment-215609729
The desired behavior is: remove a TabletLocator from the locators map one
hour *after* no other strong references to it exist. Reset the timer when a new
thread accesses the TabletLocator.
Sadly I don't see an easy way to implement this behavior.
1. If we use a timer with Guava, then a TabletLocator may be removed from
the map if a thread uses the TabletLocator for at least an hour, which could
easily happen if the thread locally caches the locator.
2. If we use soft references, then TabletLocators may be removed from the
map (in an LRU manner) at any time there are no other references to them if the
gc is pressured. This could affect performance in edge cases.
3. Using both a timer and soft references has both problems.
The approach in this PR forces threads to re-fetch a TabletLocator from the
map if the locators in the map are cleared. This happens once per hour and is
done automatically by SyncingTabletLocator. This solves the problem on its own
and may be good enough.
Perhaps the best solution is to combine it with the Guava timer (point 1
above): replacing the locators map with a Guava cache, letting entries expire
one hour after they are last accessed. We may then remove the `synchronized`
statements on TabletLocator.
Think its worth going for, or shall we stick with this?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---