sonatype-lift[bot] commented on code in PR #623:
URL: https://github.com/apache/solr/pull/623#discussion_r891717583
##########
solr/core/src/java/org/apache/solr/search/RefreshCrossCoreJoinCacheFactory.java:
##########
@@ -0,0 +1,72 @@
+package org.apache.solr.search;
+
+import org.apache.solr.common.params.SolrParams;
+import org.apache.solr.common.util.ContentStream;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.core.SolrCore;
+import org.apache.solr.request.LocalSolrQueryRequest;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.request.SolrRequestInfo;
+import org.apache.solr.response.SolrQueryResponse;
+import org.apache.solr.schema.IndexSchema;
+import org.apache.solr.update.CommitUpdateCommand;
+import org.apache.solr.update.processor.UpdateRequestProcessor;
+import org.apache.solr.update.processor.UpdateRequestProcessorFactory;
+import org.apache.solr.util.RTimerTree;
+import org.apache.solr.util.RefCounted;
+
+import java.io.IOException;
+import java.security.Principal;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This update processor is expected to be invoked on "fromIndex" side of
join to regenerate cached join.
+ * It loops through all other cores checking them if they are "toIndex" cores:
+ * those "toIndex" cores, which have user cache with name of this core
("fromIndex") are subj of regeneration.
+ *
+ * */
+public class RefreshCrossCoreJoinCacheFactory extends
UpdateRequestProcessorFactory {
+ @Override
+ public UpdateRequestProcessor getInstance(SolrQueryRequest req,
SolrQueryResponse rsp, UpdateRequestProcessor next) {
+ return new UpdateRequestProcessor(next) {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void processCommit(CommitUpdateCommand cmd) throws
IOException {
+ super.processCommit(cmd);
+ // refresh strictly after RunUpdateProcessor
+
+ final CoreContainer coreContainer =
req.getCore().getCoreContainer();
+ final List<String> possibleToSideCores =
coreContainer.getLoadedCoreNames();
+ String fromSideCore = req.getCore().getName();
+ for (String toSideCoreName: possibleToSideCores){
+ if (!toSideCoreName.equals(fromSideCore)) {
+ final SolrCore toSideCore =
coreContainer.getCore(toSideCoreName);
+ final RefCounted<SolrIndexSearcher> toSideSearcher =
toSideCore.getSearcher();
+ try {
+ @SuppressWarnings("rawtypes")
+ final SolrCache joinCache =
toSideSearcher.get().getCache(fromSideCore);
+ if (joinCache != null) {
+ // this is necessary for classic join query,
which checks SRI, I don't know why.
+ SolrQueryRequest leftReq = new
LocalSolrQueryRequest(toSideCore,req.getParams()) {
+ @Override public SolrIndexSearcher
getSearcher() { return toSideSearcher.get(); }
+ @Override public void close() { }
+ };
+ SolrQueryResponse rsp = new
SolrQueryResponse();
+ SolrRequestInfo.setRequestInfo(new
SolrRequestInfo(leftReq, rsp));
Review Comment:
*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](https://help.sonatype.com/lift/talking-to-lift) with
`help` or `ignore`)
---
Was this a good recommendation?
[ [🙁 Not
relevant](https://www.sonatype.com/lift-comment-rating?comment=271350202&lift_comment_rating=1)
] - [ [😕 Won't
fix](https://www.sonatype.com/lift-comment-rating?comment=271350202&lift_comment_rating=2)
] - [ [😑 Not critical, will
fix](https://www.sonatype.com/lift-comment-rating?comment=271350202&lift_comment_rating=3)
] - [ [🙂 Critical, will
fix](https://www.sonatype.com/lift-comment-rating?comment=271350202&lift_comment_rating=4)
] - [ [😊 Critical, fixing
now](https://www.sonatype.com/lift-comment-rating?comment=271350202&lift_comment_rating=5)
]
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]