lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r926875 - in /lucene/dev/trunk/solr: example/multicore/core0/conf/ example/multicore/core1/conf/ src/java/org/apache/solr/core/ src/test/org/apache/solr/client/solrj/
Date Wed, 24 Mar 2010 00:12:48 GMT
Author: markrmiller
Date: Wed Mar 24 00:12:48 2010
New Revision: 926875

URL: http://svn.apache.org/viewvc?rev=926875&view=rev
Log:
allow RAMDir for multi-core tests - add test that docs stay after core reload - change RAMDirFactory
to work over core reloads

Modified:
    lucene/dev/trunk/solr/example/multicore/core0/conf/solrconfig.xml
    lucene/dev/trunk/solr/example/multicore/core1/conf/solrconfig.xml
    lucene/dev/trunk/solr/src/java/org/apache/solr/core/RAMDirectoryFactory.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java

Modified: lucene/dev/trunk/solr/example/multicore/core0/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/multicore/core0/conf/solrconfig.xml?rev=926875&r1=926874&r2=926875&view=diff
==============================================================================
--- lucene/dev/trunk/solr/example/multicore/core0/conf/solrconfig.xml (original)
+++ lucene/dev/trunk/solr/example/multicore/core0/conf/solrconfig.xml Wed Mar 24 00:12:48
2010
@@ -21,6 +21,13 @@
  It is *not* a good example to work from. 
 -->
 <config>
+
+  <!--  The DirectoryFactory to use for indexes.
+        solr.StandardDirectoryFactory, the default, is filesystem based.
+        solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication.
-->
+  <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
+
+
   <updateHandler class="solr.DirectUpdateHandler2" />
 
   <requestDispatcher handleSelect="true" >

Modified: lucene/dev/trunk/solr/example/multicore/core1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/multicore/core1/conf/solrconfig.xml?rev=926875&r1=926874&r2=926875&view=diff
==============================================================================
--- lucene/dev/trunk/solr/example/multicore/core1/conf/solrconfig.xml (original)
+++ lucene/dev/trunk/solr/example/multicore/core1/conf/solrconfig.xml Wed Mar 24 00:12:48
2010
@@ -21,6 +21,11 @@
  It is *not* a good example to work from. 
 -->
 <config>
+  <!--  The DirectoryFactory to use for indexes.
+        solr.StandardDirectoryFactory, the default, is filesystem based.
+        solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication.
-->
+  <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
+
   <updateHandler class="solr.DirectUpdateHandler2" />
 
   <requestDispatcher handleSelect="true" >

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/core/RAMDirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/core/RAMDirectoryFactory.java?rev=926875&r1=926874&r2=926875&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/core/RAMDirectoryFactory.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/core/RAMDirectoryFactory.java Wed Mar 24
00:12:48 2010
@@ -28,11 +28,11 @@ import org.apache.lucene.store.Directory
  * Directory provider for using lucene RAMDirectory
  */
 public class RAMDirectoryFactory extends StandardDirectoryFactory {
-  private Map<String, RefCntRamDirectory> directories = new HashMap<String, RefCntRamDirectory>();
+  private static Map<String, RefCntRamDirectory> directories = new HashMap<String,
RefCntRamDirectory>();
 
   @Override
   public Directory open(String path) throws IOException {
-    synchronized (this) {
+    synchronized (RAMDirectoryFactory.class) {
       RefCntRamDirectory directory = directories.get(path);
       if (directory == null || !directory.isOpen()) {
         directory = (RefCntRamDirectory) openNew(path);
@@ -46,7 +46,7 @@ public class RAMDirectoryFactory extends
   }
   
   public boolean exists(String path) {
-    synchronized (this) {
+    synchronized (RAMDirectoryFactory.class) {
       RefCntRamDirectory directory = directories.get(path);
       if (directory == null || !directory.isOpen()) {
         return false;

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java?rev=926875&r1=926874&r2=926875&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
(original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
Wed Mar 24 00:12:48 2010
@@ -130,6 +130,9 @@ public abstract class MultiCoreExampleTe
     long before = mcr.getStartTime( name ).getTime();
     CoreAdminRequest.reloadCore( name, coreadmin );
     
+    // core should still have docs
+    assertEquals( 1, getSolrCore0().query( new SolrQuery( "id:AAA" ) ).getResults().size()
);
+    
     mcr = CoreAdminRequest.getStatus( name, coreadmin );
     long after = mcr.getStartTime( name ).getTime();
     assertTrue( "should have more recent time: "+after+","+before, after > before );



Mime
View raw message