Permalink
Browse files

merged tamas' fix from trunk

git-svn-id: file:///opt/svn/repositories/sonatype.org/nexus/branches/nexus-indexer-3.0.1@6614 2aa8b3fc-8ebb-4439-a84f-95066eaea8ab
  • Loading branch information...
1 parent f02b756 commit 231dc836051a518cbbc82cdd36e1fdfde221fb7f dbradicich committed Jun 10, 2010
@@ -79,7 +79,8 @@
private NexusIndexSearcher indexSearcher;
- private NexusIndexSearcher readOnlyIndexSearcher;
+ // disabled for now, see getReadOnlyIndexSearcher() method for explanation
+ // private NexusIndexSearcher readOnlyIndexSearcher;
private NexusIndexWriter indexWriter;
@@ -461,28 +462,37 @@ public IndexSearcher getIndexSearcher()
}
}
+ @Deprecated
public IndexSearcher getReadOnlyIndexSearcher()
throws IOException
{
- synchronized ( indexLock )
- {
- if ( readOnlyIndexSearcher == null || !readOnlyIndexSearcher.getIndexReader().isCurrent() )
- {
- if ( readOnlyIndexSearcher != null )
- {
- readOnlyIndexSearcher.close();
+ return getIndexSearcher();
- // the reader was supplied explicitly
- readOnlyIndexSearcher.getIndexReader().close();
- }
+ // using RO IndexReader in this way just causes to _double_ the file handles Nexus
+ // uses to read/maintain the Lucene Indexes (once for UPDATE, once for Searches).
+ // The performance gain (no lock contention) is currently too small for the price of
+ // doubled file handles. We will have to resolve this later.
- readOnlyIndexSearcher = new NexusIndexSearcher( this, IndexReader.open( indexDirectory, true ) );
+ // disabled for now, see getReadOnlyIndexSearcher() method for explanation
+ // synchronized ( indexLock )
+ // {
+ // if ( readOnlyIndexSearcher == null || !readOnlyIndexSearcher.getIndexReader().isCurrent() )
+ // {
+ // if ( readOnlyIndexSearcher != null )
+ // {
+ // readOnlyIndexSearcher.close();
+ //
+ // // the reader was supplied explicitly
+ // readOnlyIndexSearcher.getIndexReader().close();
+ // }
+ //
+ // readOnlyIndexSearcher = new NexusIndexSearcher( this, IndexReader.open( indexDirectory, true ) );
+ // }
+ //
+ // return readOnlyIndexSearcher;
+ // }
}
- return readOnlyIndexSearcher;
- }
- }
-
public void optimize()
throws CorruptIndexException, IOException
{
@@ -686,15 +696,16 @@ private void closeReaders()
indexReader = null;
}
- if ( readOnlyIndexSearcher != null )
- {
- readOnlyIndexSearcher.close();
- // the reader was supplied explicitly
- readOnlyIndexSearcher.getIndexReader().close();
-
- readOnlyIndexSearcher = null;
- }
+ // if ( readOnlyIndexSearcher != null )
+ // {
+ // readOnlyIndexSearcher.close();
+ //
+ // // the reader was supplied explicitly
+ // readOnlyIndexSearcher.getIndexReader().close();
+ //
+ // readOnlyIndexSearcher = null;
+ // }
}
public GavCalculator getGavCalculator()
@@ -157,10 +157,11 @@ IndexSearcher getIndexSearcher()
/**
* Returns the ReadOnly IndexSearcher of this context. IndexingContext will manage this searcher in similar way as
- * the RW readers.
+ * the RW readers. -- THIS IS NOT YET FULLY DONE, DO NOT USE IT!
*
* @return
* @throws IOException
+ * @deprecated Do not use it yet! Not done!
*/
IndexSearcher getReadOnlyIndexSearcher()
throws IOException;

0 comments on commit 231dc83

Please sign in to comment.