Author: dkuleshov
Date: 2011-02-16 04:00:20 -0500 (Wed, 16 Feb 2011)
New Revision: 3979
Modified:
jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1581/JCR-1581.patch
Log:
JCR-1581: updated patch
Modified: jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1581/JCR-1581.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1581/JCR-1581.patch 2011-02-15 14:14:38 UTC
(rev 3978)
+++ jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1581/JCR-1581.patch 2011-02-16 09:00:20 UTC
(rev 3979)
@@ -1,299 +1,18 @@
-Index:
exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml
+Index:
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
----
exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml (revision
3974)
-+++
exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml (working
copy)
-@@ -100,6 +100,7 @@
- <property name="jgroups-multiplexer-stack"
value="true" />
- <property name="jbosscache-cluster-name"
value="JCR-cluster-indexer-ws" />
- <property name="max-volatile-time" value="60"
/>
-+ <property name="io-exception-retry-count" value="5"
/>
- </properties>
- </query-handler>
- </workspace></programlisting> <table>
-@@ -154,6 +155,13 @@
-
- <entry>max time to live for Volatile Index</entry>
- </row>
-+
-+ <row>
-+ <entry>io-exception-retry-count</entry>
-+
-+ <entry>IOException retries maximum number on index reader
-+ instantiation. Default value is 3</entry>
-+ </row>
- </tbody>
- </tgroup>
- </table></para>
-Index:
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java
-===================================================================
----
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java (revision
3974)
-+++
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java (working
copy)
-@@ -186,5 +186,9 @@
- {
-
searchIndex.setSpellCheckerMinDistance(StringNumberParser.parseNumber(value).floatValue());
- }
-+ else if (QueryHandlerParams.PARAM_IO_EXCEPTION_RETRY_COUNT.equals(name))
-+ {
-+
searchIndex.setIoExceptionRetryCount(StringNumberParser.parseNumber(value).intValue());
-+ }
- }
- }
-Index:
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
-===================================================================
----
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java (revision
3974)
-+++
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java (working
copy)
-@@ -92,6 +92,13 @@
- public class SearchIndex extends AbstractQueryHandler implements IndexerIoModeListener
- {
-
-+ /**
-+ * Default number of how many retries are going to be
-+ * while encountering io exception during query execution
-+ * see
https://jira.exoplatform.org/browse/JCR-1581 for more details
-+ */
-+ private static final int DEFAULT_IO_EXCEPTION_RETRY_COUNT = 3;
-+
- private static final DefaultQueryNodeFactory DEFAULT_QUERY_NODE_FACTORY = new
DefaultQueryNodeFactory();
-
- /** The logger instance for this class */
-@@ -168,6 +175,13 @@
- private static final String ERROR_LOG = "error.log";
-
- /**
-+ * Number of how many retries are going to be
-+ * while encountering io exception during query execution
-+ * see
https://jira.exoplatform.org/browse/JCR-1581 for more details
-+ */
-+ private int ioExceptionRetryCount = DEFAULT_IO_EXCEPTION_RETRY_COUNT;
-+
-+ /**
- * The actual index
- */
- private MultiIndex index;
-@@ -611,6 +625,25 @@
- }
-
- /**
-+ * Sets ioExceptionRetryCount
-+ * @param count
-+ */
-+ public void setIoExceptionRetryCount(int count)
-+ {
-+ if (count > 0)
-+ ioExceptionRetryCount = count;
-+ }
-+
-+ /**
-+ * Gets ioExceptionRetryCount
-+ * @return ioExceptionRetryCount
-+ */
-+ public int getIoExceptionRetryCount()
-+ {
-+ return ioExceptionRetryCount;
-+ }
-+
-+ /**
- * @return the errorLogfileSize
- */
- public int getErrorLogfileSize()
-@@ -708,8 +741,7 @@
+---
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java (revision
3978)
++++
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java (working
copy)
+@@ -784,6 +784,13 @@
+ // when reindexing the final commit is done at the very end
+ executeAndLog(new Commit(getTransactionId()));
}
- catch (RepositoryException e)
- {
-- log
-- .warn("Exception while creating document for node: " +
state.getIdentifier() + ": " + e.toString(), e);
-+ log.warn("Exception while creating document for node: " +
state.getIdentifier() + ": " + e.toString(), e);
- }
- return doc;
++ // force IndexInfos (IndexNames) to be written on FS and both be replicated
over cluster
++ // for non-coordinator cluster nodes be notified of new index list ASAP.
This may avoid race
++ // conditions when coordinator invokes flush() which performs
indexNames.write()
++ // and deletes obsolete index just after. Making this list be written now,
will notify non-
++ // coordinator node about new merged index and obsolete indexes long time
before they will
++ // be deleted.
++ indexNames.write();
}
-@@ -736,8 +768,7 @@
- }
- catch (RepositoryException e)
- {
-- log
-- .warn("Exception while creating document for node: " +
state.getIdentifier() + ": " + e.toString());
-+ log.warn("Exception while creating document for node: " +
state.getIdentifier() + ": " + e.toString());
- }
- return null;
- }
-@@ -870,25 +901,45 @@
-
- Sort sort = new Sort(createSortFields(orderProps, orderSpecs));
-
-- final IndexReader reader = getIndexReader(queryImpl.needsSystemTree());
-- JcrIndexSearcher searcher = new JcrIndexSearcher(session, reader,
getContext().getItemStateManager());
-- searcher.setSimilarity(getSimilarity());
-- return new FilterMultiColumnQueryHits(searcher.execute(query, sort,
resultFetchHint,
-- QueryImpl.DEFAULT_SELECTOR_NAME))
-+ for (int i = 0; i < ioExceptionRetryCount; i++)
- {
-- public void close() throws IOException
-+ final IndexReader reader = getIndexReader(queryImpl.needsSystemTree());
-+ try
+ finally
{
-+ JcrIndexSearcher searcher = new JcrIndexSearcher(session, reader,
getContext().getItemStateManager());
-+ searcher.setSimilarity(getSimilarity());
-+ return new FilterMultiColumnQueryHits(searcher.execute(query, sort,
resultFetchHint,
-+ QueryImpl.DEFAULT_SELECTOR_NAME))
-+ {
-+ public void close() throws IOException
-+ {
-+ try
-+ {
-+ super.close();
-+ }
-+ finally
-+ {
-+ PerQueryCache.getInstance().dispose();
-+ Util.closeOrRelease(reader);
-+ }
-+ }
-+ };
-+ }
-+ catch (IOException e)
-+ {
- try
- {
-- super.close();
-+ Util.closeOrRelease(reader);
- }
-- finally
-+ catch (Exception releaseException)
- {
-- PerQueryCache.getInstance().dispose();
-- Util.closeOrRelease(reader);
-+ log.warn("Error occured while closing or releasing a reader",
releaseException);
- }
- }
-- };
-+ }
-+
-+ throw new IOException("IO exception was encountered more than " +
ioExceptionRetryCount + " times");
-+
- }
-
- /**
-@@ -918,24 +969,43 @@
-
- Sort sort = new Sort(createSortFields(orderProps, orderSpecs));
-
-- final IndexReader reader = getIndexReader();
-- JcrIndexSearcher searcher = new JcrIndexSearcher(session, reader,
getContext().getItemStateManager());
-- searcher.setSimilarity(getSimilarity());
-- return new FilterMultiColumnQueryHits(query.execute(searcher, sort,
resultFetchHint))
-+ for (int i = 0; i < ioExceptionRetryCount; i++)
- {
-- public void close() throws IOException
-+ final IndexReader reader = getIndexReader();
-+ try
- {
-+ JcrIndexSearcher searcher = new JcrIndexSearcher(session, reader,
getContext().getItemStateManager());
-+ searcher.setSimilarity(getSimilarity());
-+ return new FilterMultiColumnQueryHits(query.execute(searcher, sort,
resultFetchHint))
-+ {
-+ public void close() throws IOException
-+ {
-+ try
-+ {
-+ super.close();
-+ }
-+ finally
-+ {
-+ PerQueryCache.getInstance().dispose();
-+ Util.closeOrRelease(reader);
-+ }
-+ }
-+ };
-+ }
-+ catch (IOException e)
-+ {
- try
- {
-- super.close();
-+ Util.closeOrRelease(reader);
- }
-- finally
-+ catch (Exception releaseException)
- {
-- PerQueryCache.getInstance().dispose();
-- Util.closeOrRelease(reader);
-+ log.warn("Error occured while closing or releasing a reader",
releaseException);
- }
- }
-- };
-+ }
-+
-+ throw new IOException("IO exception was encountered more than " +
ioExceptionRetryCount + " times");
- }
-
- /**
-@@ -1330,8 +1400,8 @@
- {
- File root = new File(path, synonymProviderConfigPath.substring(0,
lastSeparator));
- fsr =
-- new BufferedInputStream(new FileInputStream(new File(root,
synonymProviderConfigPath
-- .substring(lastSeparator + 1))));
-+ new BufferedInputStream(new FileInputStream(new File(root,
-+ synonymProviderConfigPath.substring(lastSeparator + 1))));
- }
- else
- {
-@@ -1540,8 +1610,7 @@
- catch (Exception e)
- {
- // do not fail if aggregate cannot be created
-- log
-- .warn("Exception while building indexing aggregate for" +
" node with UUID: " + state.getIdentifier(), e);
-+ log.warn("Exception while building indexing aggregate for" +
" node with UUID: " + state.getIdentifier(), e);
- }
- }
- }
-@@ -2712,11 +2781,32 @@
- {
- checkOpen();
-
-- IndexReader reader = getIndexReader(true);
-- IndexSearcher searcher = new IndexSearcher(reader);
-- searcher.setSimilarity(getSimilarity());
-+ IndexReader reader;
-
-- return new LuceneQueryHits(reader, searcher, query);
-+ for (int i = 0; i < ioExceptionRetryCount; i++)
-+ {
-+ reader = getIndexReader(true);
-+ try
-+ {
-+ IndexSearcher searcher = new IndexSearcher(reader);
-+ searcher.setSimilarity(getSimilarity());
-+
-+ return new LuceneQueryHits(reader, searcher, query);
-+ }
-+ catch (IOException e)
-+ {
-+ try
-+ {
-+ Util.closeOrRelease(reader);
-+ }
-+ catch (Exception releaseException)
-+ {
-+ log.warn("Error occured while closing or releasing a reader",
releaseException);
-+ }
-+ }
-+ }
-+
-+ throw new IOException("IO exception was encountered more than " +
ioExceptionRetryCount + " times");
- }
-
- /**
-Index:
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/QueryHandlerParams.java
-===================================================================
----
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/QueryHandlerParams.java (revision
3974)
-+++
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/QueryHandlerParams.java (working
copy)
-@@ -114,4 +114,7 @@
- public static final String PARAM_JBOSSCACHE_PUSHSTATE =
"jbosscache-sscl-push.state.enabled";
-
- public static final String PARAM_JBOSSCACHE_PUSHSTATE_TIMEOUT =
"jbosscache-sscl-push.state.timeout";
-+
-+ public static final String PARAM_IO_EXCEPTION_RETRY_COUNT =
"io-exception-retry-count";
-+
- }