-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP {!join cacheEventually=true ...}... #623
base: main
Are you sure you want to change the base?
Conversation
// make cross core joins time-agnostic | ||
// it should be ruled by param probably | ||
boolean crossCoreCache = false; | ||
if(localParams.getBool("cacheEventually", false)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
introducing {!join cacheEventually=true ...}...
// it should be ruled by param probably | ||
boolean crossCoreCache = false; | ||
if(localParams.getBool("cacheEventually", false)) { | ||
if (query instanceof JoinQuery) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two avoid those ugly instanceof
s I'd like to unify existing JoinQP routines to unify and extract common ancestor.
if(localParams.getBool("cacheEventually", false)) { | ||
if (query instanceof JoinQuery) { | ||
if (((JoinQuery) query).fromCoreOpenTime != 0L) { | ||
((JoinQuery) query).fromCoreOpenTime = Long.MIN_VALUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need these queries match to each other for cache hit regardless of commit in fromCore
. It can be done by setting some additional flag and changing equals
&hashCode
. WDYT?
WrappedQuery wrap = new WrappedQuery(query); | ||
wrap.setCache(false); //bypassing searcher cache | ||
@SuppressWarnings("unchecked") | ||
final SolrCache<Query,DocSet> rightSideCache = (SolrCache<Query,DocSet>) req.getSearcher().getCache(fromIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It uses left side core user cache by right side (fromCore
) name. I suppose it's a clear convention.
final Filter topFilter = docset.getTopFilter(); | ||
|
||
WrappedQuery wrappedCache = new WrappedQuery(topFilter); | ||
wrappedCache.setCache(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return non-cached query backed on doc set cached in user cache
</commitWithin> | ||
</updateHandler> | ||
|
||
<updateProcessor name="refresh-join-caches" class="solr.RefreshCrossCoreJoinCacheFactory"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This guy from the right side (fromCore) refreshes left side (to) caches.
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class RefreshCrossCoreJoinCacheFactory extends UpdateRequestProcessorFactory { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kicked on fromCore
String rightSideCore = req.getCore().getName(); | ||
for (String leftCoreName: loadedCoreNames){ | ||
if (!leftCoreName.equals(rightSideCore)) { | ||
final SolrCore core = coreContainer.getCore(leftCoreName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enumerates all possible "to" cores, find user cache with name "fromCore".
SolrQueryResponse rsp = new SolrQueryResponse(); | ||
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(leftReq, rsp)); | ||
try { | ||
joinCache.warm(leftSearcher.get(), joinCache); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self warm left side caches picking fresh "fromCore" searcher.
} else { // commit into main index refreshes cache as well | ||
assertU(add(doc("id", "99999999"))); | ||
assertU(commit()); // TODO this causes an error. | ||
// cached join leaks as query result key, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a problem so far. Doc set from old searcher breaks warming of fresh searcher. Have no solution.
@Override public void close() { } | ||
}; | ||
SolrQueryResponse rsp = new SolrQueryResponse(); | ||
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(leftReq, rsp)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RESOURCE_LEAK: resource of type org.apache.solr.search.RefreshCrossCoreJoinCacheFactory$1$1
acquired by call to RefreshCrossCoreJoinCacheFactory$1$1(...)
at line 51 is not released after line 56.
Note: potential exception at line 56
(at-me in a reply with help
or ignore
)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
b291101
to
8f2f333
Compare
No description provided.