[
https://issues.apache.org/jira/browse/SOLR-11616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16477719#comment-16477719
]
David Smiley commented on SOLR-11616:
-------------------------------------
Looking at the code for SnapShooter.getIndexCommit, I see we are getting the
refcounted searcher but forgetting to decref it. This looks like a bug and if
it isn't then definitely deserves a comment:
[https://github.com/apache/lucene-solr/blob/864ce90d2cd9bfae66506f38823278738afe6c4a/solr/core/src/java/org/apache/solr/handler/SnapShooter.java#L173]
As an aside, this incref, decref business is error-prone. I propose the
following new method on SolrCore:
{code:java}
/**
* Executes the lambda with the {@link SolrIndexSearcher}. This is more
convenient than using
* {@link #getSearcher()} since there is no ref-counting business to worry
about.
* Example:
* <pre class="prettyprint">
* IndexReader reader =
h.getCore().withSearcher(SolrIndexSearcher::getIndexReader);
* </pre>
*/
@SuppressWarnings("unchecked")
public <R> R withSearcher(Function<SolrIndexSearcher,R> lambda) {
final RefCounted<SolrIndexSearcher> refCounted = getSearcher();
try {
return lambda.apply(refCounted.get());
} finally {
refCounted.decref();
}
}
{code}
> Backup failing on a constantly changing index with NoSuchFileException
> ----------------------------------------------------------------------
>
> Key: SOLR-11616
> URL: https://issues.apache.org/jira/browse/SOLR-11616
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Varun Thacker
> Assignee: Varun Thacker
> Priority: Major
> Fix For: 7.2, master (8.0)
>
> Attachments: SOLR-11616.patch, SOLR-11616.patch, solr-6.3.log,
> solr-7.1.log
>
>
> As reported by several users on SOLR-9120 , Solr backups fail with
> NoSuchFileException on a constantly changing index.
> Users linked SOLR-9120 to the root cause as the stack trace is the same , but
> the fix proposed there won't fix backups to stop failing.
> We need to implement a similar fix in {{SnapShooter#createSnapshot}} to fix
> the problem
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]