Author: nzamosenchuk
Date: 2012-03-14 05:05:40 -0400 (Wed, 14 Mar 2012)
New Revision: 5861
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
Log:
EXOJCR-1803 : changing asserts and logging events
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2012-03-13
17:01:38 UTC (rev 5860)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2012-03-14
09:05:40 UTC (rev 5861)
@@ -462,42 +462,60 @@
try
{
- // if "from-coordinator" used along with RPC Service present and
- if
(handler.getIndexRecoveryMode().equals(SearchIndex.INDEX_RECOVERY_MODE_FROM_COORDINATOR)
- && handler.getContext().getIndexRecovery() != null &&
handler.getContext().getRPCService() != null
- && handler.getContext().getRPCService().isCoordinator() == false)
+ // isRecoveryFilterUsed returns true only if LocalIndex strategy used
+ if (handler.getContext().isRecoveryFilterUsed())
{
- log.info("Retrieving index from coordinator (" +
handler.getContext().getWorkspacePath(true) + ")...");
- indexCreated = recoveryIndexFromCoordinator();
-
- if (indexCreated)
+ // if "from-coordinator" index recovery configured
+ if
(SearchIndex.INDEX_RECOVERY_MODE_FROM_COORDINATOR.equals(handler.getIndexRecoveryMode()))
{
- indexNames.read();
- refreshIndexList();
- }
- else
- {
- log.info("Index can'b be retrieved from coordinator now,
because it is offline. "
- + "Possibly coordinator node performs reindexing now. Switching
to local re-indexing.");
- }
- }
+ if (handler.getContext().getIndexRecovery() != null &&
handler.getContext().getRPCService() != null
+ && !handler.getContext().getRPCService().isCoordinator())
+ {
+ log.info("Retrieving index from coordinator (" +
handler.getContext().getWorkspacePath(true)
+ + ")...");
+ indexCreated = recoveryIndexFromCoordinator();
- if (!indexCreated)
- {
- if
(handler.getIndexRecoveryMode().equals(SearchIndex.INDEX_RECOVERY_MODE_FROM_COORDINATOR))
- {
- if (handler.getContext().getRPCService() == null)
- {
- log.error("RPC Service is not configured but required for
copying the index "
- + "from coordinator node. Index will be created by
re-indexing.");
+ if (indexCreated)
+ {
+ indexNames.read();
+ refreshIndexList();
+ }
+ else
+ {
+ log.info("Index can'b be retrieved from coordinator now,
because it is offline. "
+ + "Possibly coordinator node performs reindexing now.
Switching to local re-indexing.");
+ }
}
- else if (handler.getContext().getRPCService().isCoordinator() == true)
+ else
{
- log.info("Copying the index from coordinator configured, but
this node is the "
- + "only one in a cluster. Index will be created by
re-indexing.");
+ if (handler.getContext().getRPCService() == null)
+ {
+ // logging an event, when RPCService is not configured in
clustered mode
+ log.error("RPC Service is not configured but required for
copying the index "
+ + "from coordinator node. Index will be created by
re-indexing.");
+ }
+ else
+ {
+ if (handler.getContext().getIndexRecovery() == null)
+ {
+ // Should never occurs, but logging an event, when RPCService
configured, but IndexRecovery
+ // instance is missing
+ log.error("Instance of IndexRecovery class is missing for
unknown reason. Index will be"
+ + " created by re-indexing.");
+ }
+ if (handler.getContext().getRPCService().isCoordinator())
+ {
+ // logging an event when first node starts
+ log.info("Copying the index from coordinator configured,
but this node is the "
+ + "only one in a cluster. Index will be created by
re-indexing.");
+ }
+ }
}
}
+ }
+ if (!indexCreated)
+ {
// traverse and index workspace
executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
@@ -2591,8 +2609,8 @@
/**
* The maximum length of a AddNode String.
*/
- private static final int ENTRY_LENGTH =
- Long.toString(Long.MAX_VALUE).length() + Action.ADD_NODE.length() +
Constants.UUID_FORMATTED_LENGTH + 2;
+ private static final int ENTRY_LENGTH = Long.toString(Long.MAX_VALUE).length() +
Action.ADD_NODE.length()
+ + Constants.UUID_FORMATTED_LENGTH + 2;
/**
* The uuid of the node to add.
@@ -2993,8 +3011,8 @@
/**
* The maximum length of a DeleteNode String.
*/
- private static final int ENTRY_LENGTH =
- Long.toString(Long.MAX_VALUE).length() + Action.DELETE_NODE.length() +
Constants.UUID_FORMATTED_LENGTH + 2;
+ private static final int ENTRY_LENGTH = Long.toString(Long.MAX_VALUE).length() +
Action.DELETE_NODE.length()
+ + Constants.UUID_FORMATTED_LENGTH + 2;
/**
* The uuid of the node to remove.