jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r801135 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene: MultiIndex.java Recovery.java SearchIndex.java
Date Wed, 05 Aug 2009 11:29:12 GMT
Author: mreutegg
Date: Wed Aug  5 11:29:12 2009
New Revision: 801135

URL: http://svn.apache.org/viewvc?rev=801135&view=rev
Log:
JCR-2219: Improved background text extraction
- fix occasional test failures

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/Recovery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java?rev=801135&r1=801134&r2=801135&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
Wed Aug  5 11:29:12 2009
@@ -436,7 +436,7 @@
 
             // flush whole index when volatile index has been commited.
             if (flush) {
-                flush();
+                internalFlush();
             }
         } finally {
             synchronized (updateMonitor) {
@@ -781,7 +781,7 @@
                 log.error("Exception while closing search index.", e);
             }
             try {
-                flush();
+                internalFlush();
             } catch (IOException e) {
                 log.error("Exception while closing search index.", e);
             }
@@ -881,11 +881,33 @@
 
     /**
      * Flushes this <code>MultiIndex</code>. Persists all pending changes and
-     * resets the redo log.
+     * resets the redo log. When this method returned the {@link #multiReader}
+     * is released and and set to <code>null</code>.
      *
      * @throws IOException if the flush fails.
      */
     void flush() throws IOException {
+        synchronized (updateMonitor) {
+            updateInProgress = true;
+        }
+        try {
+            internalFlush();
+        } finally {
+            synchronized (updateMonitor) {
+                updateInProgress = false;
+                updateMonitor.notifyAll();
+                releaseMultiReader();
+            }
+        }
+    }
+
+    /**
+     * Flushes this <code>MultiIndex</code>. Persists all pending changes and
+     * resets the redo log.
+     *
+     * @throws IOException if the flush fails.
+     */
+    private void internalFlush() throws IOException {
         synchronized (this) {
             // commit volatile index
             executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
@@ -1154,18 +1176,7 @@
                 if (redoLog.hasEntries()) {
                     log.debug("Flushing index after being idle for "
                             + idleTime + " ms.");
-                    synchronized (updateMonitor) {
-                        updateInProgress = true;
-                    }
-                    try {
-                        flush();
-                    } finally {
-                        synchronized (updateMonitor) {
-                            updateInProgress = false;
-                            updateMonitor.notifyAll();
-                            releaseMultiReader();
-                        }
-                    }
+                    flush();
                 }
             } catch (IOException e) {
                 log.error("Unable to commit volatile index", e);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/Recovery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/Recovery.java?rev=801135&r1=801134&r2=801135&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/Recovery.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/Recovery.java
Wed Aug  5 11:29:12 2009
@@ -170,6 +170,5 @@
 
         // now we are consistent again -> flush
         index.flush();
-        index.releaseMultiReader();
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=801135&r1=801134&r2=801135&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
Wed Aug  5 11:29:12 2009
@@ -755,6 +755,9 @@
         try {
             index.getIndexingQueue().waitUntilEmpty();
             index.flush();
+            // flush may have pushed nodes into the indexing queue
+            // -> wait again
+            index.getIndexingQueue().waitUntilEmpty();
         } catch (IOException e) {
             throw new RepositoryException("Failed to flush the index", e);
         }



Mime
View raw message