lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@lucidimagination.com>
Subject Re: Funny Null checking in ReplicationHandler
Date Mon, 26 Oct 2009 00:23:21 GMT
done.  r829682

-Yonik
http://www.lucidimagination.com



On Sun, Oct 25, 2009 at 8:36 AM, Yonik Seeley
<yonik@lucidimagination.com> wrote:
> On Sun, Oct 25, 2009 at 8:28 AM, Mark Miller <markrmiller@gmail.com> wrote:
>>
>>        RefCounted<SolrIndexSearcher> s = core.getNewestSearcher(false);
>>        try {
>>          IndexReader reader = s==null ? null : s.get().getReader();
>>          if (reader!=null && reader.getIndexCommit() != null &&
>> reader.getIndexCommit().getGeneration() != 1L) {
>>
>> If getNewestSearcher(false) happens to return null, we are in for a
>> nasty surprise when it next trys to decref the null Searcher:
>>
>>  } catch (IOException e) {
>>          LOG.warn("Unable to get IndexCommit on startup", e);
>>  } finally {
>>          s.decref();
>>  }
>>
>> Some internal disagreement in that code...
>
>
> Yep, good catch.  I recently added the null check, because we
> shouldn't assume there will always be an open reader (today I think
> there will be, but tomorrow?).  That should be extended to the
> decref().
>
> -Yonik
> http://www.lucidimagination.com
>

Mime
View raw message