[exo-jcr-commits] exo-jcr SVN: r1514 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jan 20 11:08:29 EST 2010


Author: skabashnyuk
Date: 2010-01-20 11:08:29 -0500 (Wed, 20 Jan 2010)
New Revision: 1514

Modified:
   jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
Log:
EXOJCR-423 :  run recover only if modeHandler.getMode() == IndexerIoMode.READ_WRITE

Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java	2010-01-20 15:55:01 UTC (rev 1513)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java	2010-01-20 16:08:29 UTC (rev 1514)
@@ -155,7 +155,7 @@
     * Default is (-1) that means no maximal timeout set
     */
    public static final int DEFAULT_MAX_VOLATILE_TIME = -1;
-   
+
    /**
     * The default value for {@link #termInfosIndexDivisor}.
     */
@@ -205,7 +205,7 @@
     * be flush to FS not later then in maxVolatileTime seconds.
     */
    private int maxVolatileTime = DEFAULT_MAX_VOLATILE_TIME;
-   
+
    /**
     * volatileIdleTime config parameter.
     */
@@ -487,8 +487,12 @@
 
          indexDirectory = new File(path);
          if (!indexDirectory.exists())
+         {
             if (!indexDirectory.mkdirs())
+            {
                throw new RepositoryException("fail to create index dir " + path);
+            }
+         }
       }
       else
       {
@@ -587,7 +591,10 @@
       File file = new File(indexDirectory, ERROR_LOG);
       errorLog = new ErrorLog(file, errorLogfileSize);
       // reprocess any notfinished notifies;
-      recoverErrorLog(errorLog);
+      if (modeHandler.getMode() == IndexerIoMode.READ_WRITE)
+      {
+         recoverErrorLog(errorLog);
+      }
 
    }
 
@@ -1653,9 +1660,13 @@
                         String uuid = doc.get(FieldNames.UUID);
                         ItemData itd = ism.getItemData(uuid);
                         if (itd == null)
+                        {
                            continue;
+                        }
                         if (!itd.isNode())
+                        {
                            throw new RepositoryException("Item with id:" + uuid + " is not a node");
+                        }
                         map.put(uuid, (NodeData)itd);
                         found++;
                      }
@@ -2635,8 +2646,10 @@
                         return (NodeData)item; // return node here
                      }
                      else
+                     {
                         log.warn("Node expected but property found with id " + id + ". Skipping "
                            + item.getQPath().getAsString());
+                     }
                   }
                   else
                   {



More information about the exo-jcr-commits mailing list