exo-jcr SVN: r4920 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent: jbosscache and 1 other directory.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-09-16 06:18:41 -0400 (Fri, 16 Sep 2011)
New Revision: 4920
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-1541: Bloom Filters have been disabled for JBC
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-09-16 07:50:59 UTC (rev 4919)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-09-16 10:18:41 UTC (rev 4920)
@@ -2392,7 +2392,7 @@
{
if (LOG.isDebugEnabled())
{
- LOG.debug("The method addListener is not supported", e);
+ LOG.debug("The bloom filters are disabled as they are not supported by the cache implementation " + cache.getClass().getName());
}
return;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2011-09-16 07:50:59 UTC (rev 4919)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2011-09-16 10:18:41 UTC (rev 4920)
@@ -546,30 +546,11 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut, false));
+ local.get(), useExpiration, expirationTimeOut));
return parentCache.get(fqn, key);
}
-
- protected Object putWithNotification(Fqn fqn, Serializable key, Object value)
- {
- CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut, true));
- return parentCache.get(fqn, key);
- }
-
- protected Object putWithNotification(Fqn fqn, Serializable key, Object value, boolean putIfAbsent)
- {
- if (putIfAbsent)
- {
- putIfAbsent(fqn, key, value, true);
- return null;
- }
- return putWithNotification(fqn, key, value);
- }
-
/**
* in case putIfAbsent is set to <code>true</code> this method will
* call cache.putIfAbsent(Fqn fqn, Serializable key, Object value)
@@ -590,18 +571,13 @@
*/
protected Object putIfAbsent(Fqn fqn, Serializable key, Object value)
{
- return putIfAbsent(fqn, key, value, false);
- }
-
- protected Object putIfAbsent(Fqn fqn, Serializable key, Object value, boolean eventNotification)
- {
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new PutIfAbsentKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut, eventNotification));
+ local.get(), useExpiration, expirationTimeOut));
return null;
}
- public Object putInBuffer(Fqn fqn, Serializable key, Object value, boolean eventNotification)
+ public Object putInBuffer(Fqn fqn, Serializable key, Object value)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
@@ -609,7 +585,7 @@
Object prevObject = getObjectFromChangesContainer(changesContainer, fqn, key);
changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut, eventNotification));
+ local.get(), useExpiration, expirationTimeOut));
if (prevObject != null)
{
@@ -715,17 +691,9 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get(),
- useExpiration, expirationTimeOut, false));
+ useExpiration, expirationTimeOut));
return true;
}
-
- protected boolean removeNode(Fqn fqn, boolean eventNotification)
- {
- CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get(),
- useExpiration, expirationTimeOut, eventNotification));
- return true;
- }
/* (non-Javadoc)
* @see org.jboss.cache.Cache#removeNode(java.lang.String)
@@ -861,11 +829,9 @@
protected final boolean useExpiration;
protected final long timeOut;
-
- protected final boolean eventNotification;
public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache, int historicalIndex,
- boolean localMode, boolean useExpiration, long timeOut, boolean eventNotification)
+ boolean localMode, boolean useExpiration, long timeOut)
{
super();
this.fqn = fqn;
@@ -875,7 +841,6 @@
this.localMode = localMode;
this.useExpiration = useExpiration;
this.timeOut = timeOut;
- this.eventNotification = eventNotification;
}
/**
@@ -917,16 +882,14 @@
return result == 0 ? historicalIndex - o.getHistoricalIndex() : result;
}
- protected void setOptionOverrides()
+ protected void setCacheLocalMode()
{
cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(localMode);
- cache.getInvocationContext().getOptionOverrides().setSuppressEventNotification(!eventNotification);
}
public final void putExpiration(Fqn efqn)
{
- cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(localMode);
- cache.getInvocationContext().getOptionOverrides().setSuppressEventNotification(true);
+ setCacheLocalMode();
cache.put(efqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
}
@@ -948,7 +911,7 @@
public PutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
Cache<Serializable, Object> cache, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.PUT, cache, historicalIndex, local, useExpiration, timeOut);
this.data = data;
}
@@ -961,7 +924,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, data);
}
}
@@ -976,9 +939,9 @@
private final Object value;
public PutIfAbsentKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local, boolean useExpiration, long timeOut, boolean eventNotification)
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut, eventNotification);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
}
@@ -997,7 +960,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, key, value);
}
@@ -1018,9 +981,9 @@
private final Object value;
public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local, boolean useExpiration, long timeOut, boolean eventNotification)
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut, eventNotification);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
}
@@ -1033,7 +996,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, key, value);
}
}
@@ -1053,7 +1016,7 @@
public AddToListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
boolean forceModify, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
this.forceModify = forceModify;
@@ -1082,7 +1045,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, key, newSet);
}
else if (existingObject != null)
@@ -1095,7 +1058,6 @@
{
// to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
// and we are in a non local mode, we clear the list in order to enforce other cluster nodes to reload it from the db
- setOptionOverrides();
cache.put(fqn, key, null);
}
}
@@ -1121,7 +1083,7 @@
public AddToPatternListContainer(Fqn fqn, Serializable patternKey, Serializable listKey, ItemData value,
Cache<Serializable, Object> cache, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.patternKey = patternKey;
this.listKey = listKey;
this.value = value;
@@ -1134,7 +1096,6 @@
{
// to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
// and we are in a non local mode, we remove all the patterns in order to enforce other cluster nodes to reload them from the db
- setOptionOverrides();
cache.removeNode(fqn);
return;
}
@@ -1165,14 +1126,14 @@
continue;
}
Set<String> newSet = new HashSet<String>((Set<String>)setObject);
- newSet.add(value.getIdentifier());
+ newSet.add(value.getIdentifier());
if (useExpiration)
{
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(patternFqn, listKey, newSet);
}
}
@@ -1197,7 +1158,7 @@
public RemoveFromListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
this.value = value;
}
@@ -1219,7 +1180,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(fqn, key, newSet);
}
}
@@ -1245,7 +1206,7 @@
public RemoveFromPatternListContainer(Fqn fqn, Serializable patternKey, Serializable listKey, ItemData value,
Cache<Serializable, Object> cache, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.patternKey = patternKey;
this.listKey = listKey;
this.value = value;
@@ -1287,7 +1248,7 @@
putExpiration(fqn);
}
- setOptionOverrides();
+ setCacheLocalMode();
cache.put(patternFqn, listKey, newSet);
}
}
@@ -1310,14 +1271,14 @@
public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex,
boolean local, boolean useExpiration, long timeOut)
{
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
this.key = key;
}
@Override
public void apply()
{
- setOptionOverrides();
+ setCacheLocalMode();
cache.remove(fqn, key);
}
@@ -1332,19 +1293,13 @@
public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local,
boolean useExpiration, long timeOut)
{
- this(fqn, cache, historicalIndex, local, useExpiration, timeOut, false);
+ super(fqn, ChangesType.REMOVE, cache, historicalIndex, local, useExpiration, timeOut);
}
- public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local,
- boolean useExpiration, long timeOut, boolean eventNotification)
- {
- super(fqn, ChangesType.REMOVE, cache, historicalIndex, local, useExpiration, timeOut, eventNotification);
- }
-
@Override
public void apply()
{
- setOptionOverrides();
+ setCacheLocalMode();
cache.removeNode(fqn);
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-09-16 07:50:59 UTC (rev 4919)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-09-16 10:18:41 UTC (rev 4920)
@@ -60,12 +60,10 @@
import org.jboss.cache.CacheStatus;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
-import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import org.jboss.cache.jmx.JmxRegistrationManager;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.picocontainer.Startable;
import java.io.File;
@@ -82,7 +80,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
@@ -191,12 +188,7 @@
protected final Fqn<String> childNodesByPatternList;
protected final Fqn<String> rootFqn;
-
- /**
- * The list of all the listeners
- */
- private final List<WorkspaceStorageCacheListener> listeners = new CopyOnWriteArrayList<WorkspaceStorageCacheListener>();
-
+
private final CacheActionNonTxAware<Void, Void> commitTransaction = new CacheActionNonTxAware<Void, Void>()
{
@Override
@@ -690,8 +682,7 @@
createResidentNode(childPropsByPatternList);
createResidentNode(childNodesByPatternList);
createResidentNode(itemsRoot);
- this.cache.addCacheListener(new CacheEventListener());
-
+
if (jmxManager != null)
{
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
@@ -744,7 +735,6 @@
if (!cacheRoot.hasChild(fqn))
{
cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache.getInvocationContext().getOptionOverrides().setSuppressEventNotification(true);
cacheRoot.addChild(fqn).setResident(true);
}
else
@@ -1513,8 +1503,8 @@
}
// add in ITEMS
- return (ItemData)cache.putWithNotification(makeItemFqn(node.getIdentifier()), ITEM_DATA, node,
- modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
+ return (ItemData) cache.put(makeItemFqn(node.getIdentifier()), ITEM_DATA, node,
+ modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
}
/**
@@ -1582,8 +1572,7 @@
}
// add in ITEMS
// NullNodeData must never be returned inside internal cache operations.
- ItemData returnedData =
- (ItemData)cache.putInBuffer(makeItemFqn(node.getIdentifier()), ITEM_DATA, node, modifyListsOfChild != ModifyChildOption.NOT_MODIFY);
+ ItemData returnedData = (ItemData)cache.putInBuffer(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
return (returnedData instanceof NullItemData) ? null : returnedData;
}
@@ -1636,8 +1625,8 @@
// add in ITEMS
// NullItemData must never be returned inside internal cache operations.
ItemData returnedData =
- (ItemData)cache.putWithNotification(makeItemFqn(prop.getIdentifier()), ITEM_DATA, prop,
- modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
+ (ItemData) cache.put(makeItemFqn(prop.getIdentifier()), ITEM_DATA, prop,
+ modifyListsOfChild == ModifyChildOption.NOT_MODIFY);
return (returnedData instanceof NullItemData) ? null : (PropertyData) returnedData;
}
@@ -1703,7 +1692,7 @@
}
// remove from ITEMS
- cache.removeNode(makeItemFqn(item.getIdentifier()), true);
+ cache.removeNode(makeItemFqn(item.getIdentifier()));
}
/**
@@ -1713,7 +1702,7 @@
*/
protected void updateMixin(NodeData node)
{
- NodeData prevData = (NodeData)cache.putWithNotification(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
+ NodeData prevData = (NodeData)cache.put(makeItemFqn(node.getIdentifier()), ITEM_DATA, node);
// prevent update NullNodeData
if (prevData != null && !(prevData instanceof NullItemData))
{
@@ -1845,7 +1834,7 @@
.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
.getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
// update this node
- cache.putWithNotification(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
+ cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
}
else
{
@@ -1863,7 +1852,7 @@
TransientPropertyData newProp =
new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
- cache.putWithNotification(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
+ cache.put(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
}
}
}
@@ -1898,7 +1887,7 @@
TransientPropertyData newProp =
new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
- cache.putWithNotification(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
+ cache.put(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
}
// update child nodes
@@ -1914,7 +1903,7 @@
.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
.getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
// update this node
- cache.putWithNotification(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
+ cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
// update childs recursive
updateTreePath(newNode.getIdentifier(), newNode.getQPath(), inheritACL ? acl : null);
}
@@ -1945,7 +1934,7 @@
prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
.getParentIdentifier(), acl);
// update this node
- cache.putWithNotification(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
+ cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
// update childs recursive
updateChildsACL(newNode.getIdentifier(), acl);
}
@@ -2097,7 +2086,9 @@
*/
public void addListener(WorkspaceStorageCacheListener listener)
{
- listeners.add(listener);
+ // As the listeners in JBC really slow down the whole application, we decided to disable
+ // the bloom filters in case of JBC
+ throw new UnsupportedOperationException("The cache listeners are not supported by the LinkedWorkspaceStorageCacheImpl");
}
/**
@@ -2105,33 +2096,12 @@
*/
public void removeListener(WorkspaceStorageCacheListener listener)
{
- listeners.remove(listener);
+ // As the listeners in JBC really slow down the whole application, we decided to disable
+ // the bloom filters in case of JBC
+ throw new UnsupportedOperationException("The cache listeners are not supported by the LinkedWorkspaceStorageCacheImpl");
}
/**
- * Called when a cache entry corresponding to the given node has item updated
- * @param data the item corresponding to the updated cache entry
- */
- private void onCacheEntryUpdated(ItemData data)
- {
- if (data == null || data instanceof NullItemData)
- {
- return;
- }
- for (WorkspaceStorageCacheListener listener : listeners)
- {
- try
- {
- listener.onCacheEntryUpdated(data);
- }
- catch (Exception e)
- {
- LOG.warn("The method onCacheEntryUpdated fails for the listener " + listener.getClass(), e);
- }
- }
- }
-
- /**
* Actions that are not supposed to be called within a transaction
*
* Created by The eXo Platform SAS
@@ -2149,20 +2119,4 @@
return JBossCacheWorkspaceStorageCache.this.getTransactionManager();
}
}
-
- @org.jboss.cache.notifications.annotation.CacheListener
- @SuppressWarnings("unchecked")
- public class CacheEventListener
- {
-
- @NodeModified
- public void nodeModified(NodeModifiedEvent ne)
- {
- if (!ne.isPre() && ne.getFqn().isChildOf(itemsRoot))
- {
- final Map<Serializable, Object> data = ne.getData();
- onCacheEntryUpdated((ItemData)(data == null ? null : data.get(ITEM_DATA)));
- }
- }
- }
}
14 years, 7 months
exo-jcr SVN: r4919 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query: lucene and 1 other directory.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2011-09-16 03:50:59 -0400 (Fri, 16 Sep 2011)
New Revision: 4919
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
Log:
EXOJCR-1505 : ConfigurationPropertyRecoveryFilter added.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java 2011-09-16 07:25:04 UTC (rev 4918)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java 2011-09-16 07:50:59 UTC (rev 4919)
@@ -206,5 +206,9 @@
{
searchIndex.addRecoveryFilterClass(value);
}
+ else
+ {
+ searchIndex.addOptionalParameter(name, value);
+ }
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2011-09-16 07:25:04 UTC (rev 4918)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2011-09-16 07:50:59 UTC (rev 4919)
@@ -41,6 +41,7 @@
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.services.document.DocumentReaderService;
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
+import org.exoplatform.services.jcr.config.QueryHandlerParams;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.ItemData;
@@ -81,6 +82,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -527,6 +529,8 @@
protected List<AbstractRecoveryFilter> recoveryFilters = null;
+ protected Map<String, String> optionalParameters = new HashMap<String, String>();
+
/**
* Working constructor.
*
@@ -721,6 +725,30 @@
}
/**
+ * Puts optional parameter not listed in {@link QueryHandlerParams}. Usually used by
+ * extended plug-ins or services like RecoveryFilters.
+ *
+ * @param key
+ * @param value
+ */
+ public void addOptionalParameter(String key, String value)
+ {
+ optionalParameters.put(key, value);
+ }
+
+ /**
+ * Returns whole set of optional (additional) parameters from QueryHandlerEntry
+ * that are not listed in {@link QueryHandlerParams}. Can be used by extended
+ * services and plug-ins requirind additional configuration.
+ *
+ * @return unmodifiable map
+ */
+ public Map<String, String> getOptionalParameters()
+ {
+ return Collections.unmodifiableMap(optionalParameters);
+ }
+
+ /**
* Invokes all recovery filters from the set
* @return true if any filter requires reindexing
*/
14 years, 7 months
exo-jcr SVN: r4918 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2011-09-16 03:25:04 -0400 (Fri, 16 Sep 2011)
New Revision: 4918
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConfigurationPropertyRecoveryFilter.java
Log:
EXOJCR-1505 : ConfigurationPropertyRecoveryFilter added.
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConfigurationPropertyRecoveryFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConfigurationPropertyRecoveryFilter.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConfigurationPropertyRecoveryFilter.java 2011-09-16 07:25:04 UTC (rev 4918)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.core.query.lucene;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Filter returns the value of QueryHandler configuration property "index-recovery-filter-forcereindexing"
+ *
+ * @author <a href="mailto:nzamosenchuk@exoplatform.com">Nikolay Zamosenchul</a>
+ * @version $Id: ConfigurationPropertyRecoveryFilter.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
+ */
+public class ConfigurationPropertyRecoveryFilter extends AbstractRecoveryFilter
+{
+
+ public static final String FORCE_REINDEXING_RECOVERY_FILTER_CONFIG_PROPERTY =
+ "index-recovery-filter-forcereindexing";
+
+ /**
+ * @param searchIndex
+ */
+ public ConfigurationPropertyRecoveryFilter(SearchIndex searchIndex)
+ {
+ super(searchIndex);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean accept() throws RepositoryException
+ {
+ return Boolean.valueOf(searchIndex.getOptionalParameters().get(FORCE_REINDEXING_RECOVERY_FILTER_CONFIG_PROPERTY));
+ }
+}
Property changes on: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConfigurationPropertyRecoveryFilter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 7 months
exo-jcr SVN: r4917 - in kernel/trunk/exo.kernel.container/src: test/resources/xsd_1_0 and 2 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-09-15 12:56:12 -0400 (Thu, 15 Sep 2011)
New Revision: 4917
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml
kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml
kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_2/sample-configuration-17.xml
Log:
EXOJCR-1540: default property values produce an validation error with <int> and <long> tag
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2011-09-15 12:44:37 UTC (rev 4916)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2011-09-15 16:56:12 UTC (rev 4917)
@@ -21,6 +21,7 @@
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.xml.Configuration;
+import org.exoplatform.container.xml.Deserializer;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jibx.runtime.BindingDirectory;
@@ -29,6 +30,7 @@
import org.jibx.runtime.JiBXException;
import org.w3c.dom.Document;
import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -153,61 +155,60 @@
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", KERNEL_NAMESPACES);
factory.setNamespaceAware(true);
factory.setValidating(true);
-
- try
+ return SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Boolean>()
{
- DocumentBuilder builder = null;
- try
+ public Boolean run() throws Exception
{
- builder = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<DocumentBuilder>()
+ try
{
- public DocumentBuilder run() throws Exception
- {
- return factory.newDocumentBuilder();
- }
- });
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof ParserConfigurationException)
- {
- throw (ParserConfigurationException)cause;
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Reporter reporter = new Reporter(url);
+ builder.setErrorHandler(reporter);
+ builder.setEntityResolver(Namespaces.resolver);
+ String content = Deserializer.resolveVariables(readStream(url.openStream()));
+ InputSource is = new InputSource(new StringReader(content));
+ builder.parse(is);
+ return reporter.valid;
}
- else if (cause instanceof RuntimeException)
+ catch (ParserConfigurationException e)
{
- throw (RuntimeException)cause;
+ log.error("Got a parser configuration exception when doing XSD validation");
+ return false;
}
- else
+ catch (SAXException e)
{
- throw new RuntimeException(cause);
+ log.error("Got a sax exception when doing XSD validation");
+ return false;
}
}
-
- Reporter reporter = new Reporter(url);
- builder.setErrorHandler(reporter);
- builder.setEntityResolver(Namespaces.resolver);
- builder.parse(SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<InputStream>()
+ });
+ }
+
+ private String readStream(InputStream inputStream) throws IOException
+ {
+ try
+ {
+ StringBuilder out = new StringBuilder();
+ byte[] b = new byte[4096];
+ for (int n; (n = inputStream.read(b)) != -1;)
{
- public InputStream run() throws Exception
- {
- return url.openStream();
- }
- }));
- return reporter.valid;
+ out.append(new String(b, 0, n));
+ }
+ return out.toString();
}
- catch (ParserConfigurationException e)
+ finally
{
- log.error("Got a parser configuration exception when doing XSD validation");
- return false;
+ try
+ {
+ inputStream.close();
+ }
+ catch (Exception e)
+ {
+ // ignore me
+ }
}
- catch (SAXException e)
- {
- log.error("Got a sax exception when doing XSD validation");
- return false;
- }
}
-
+
public Configuration unmarshall(final URL url) throws Exception
{
if (PropertyManager.isDevelopping())
Modified: kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml 2011-09-15 12:44:37 UTC (rev 4916)
+++ kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_0/sample-configuration-17.xml 2011-09-15 16:56:12 UTC (rev 4917)
@@ -83,5 +83,18 @@
</object-param>
</init-params>
</component>
+ <component>
+ <type>org.exoplatform.container.TestExoContainer$C3</type>
+ <init-params>
+ <object-param>
+ <name>O1</name>
+ <object type="org.exoplatform.container.TestExoContainer$O1">
+ <field name="name"><string>IdentityCache</string></field>
+ <field name="maxSize"><int>${cache.exo.social.IdentityCache.Capacity:200}</int></field>
+ <field name="liveTime"><long>${cache.exo.social.IdentityCache.TimeToLive:-1}</long></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
</configuration>
\ No newline at end of file
Modified: kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml 2011-09-15 12:44:37 UTC (rev 4916)
+++ kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_1/sample-configuration-17.xml 2011-09-15 16:56:12 UTC (rev 4917)
@@ -83,5 +83,17 @@
</object-param>
</init-params>
</component>
-
+ <component profiles="testDefaultValue">
+ <type>org.exoplatform.container.TestExoContainer$C3</type>
+ <init-params>
+ <object-param>
+ <name>O1</name>
+ <object type="org.exoplatform.container.TestExoContainer$O1">
+ <field name="name"><string>IdentityCache</string></field>
+ <field name="maxSize"><int>${cache.exo.social.IdentityCache.Capacity:200}</int></field>
+ <field name="liveTime"><long>${cache.exo.social.IdentityCache.TimeToLive:-1}</long></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
</configuration>
\ No newline at end of file
Modified: kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_2/sample-configuration-17.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_2/sample-configuration-17.xml 2011-09-15 12:44:37 UTC (rev 4916)
+++ kernel/trunk/exo.kernel.container/src/test/resources/xsd_1_2/sample-configuration-17.xml 2011-09-15 16:56:12 UTC (rev 4917)
@@ -83,5 +83,17 @@
</object-param>
</init-params>
</component>
-
+ <component profiles="testDefaultValue">
+ <type>org.exoplatform.container.TestExoContainer$C3</type>
+ <init-params>
+ <object-param>
+ <name>O1</name>
+ <object type="org.exoplatform.container.TestExoContainer$O1">
+ <field name="name"><string>IdentityCache</string></field>
+ <field name="maxSize"><int>${cache.exo.social.IdentityCache.Capacity:200}</int></field>
+ <field name="liveTime"><long>${cache.exo.social.IdentityCache.TimeToLive:-1}</long></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
</configuration>
\ No newline at end of file
14 years, 7 months
exo-jcr SVN: r4916 - in jcr/branches/1.12.x/patch/1.12.11-GA: JCR-1667 and 1 other directory.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-09-15 08:44:37 -0400 (Thu, 15 Sep 2011)
New Revision: 4916
Added:
jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1667/
jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1667/JCR-1667.patch
Log:
JCR-1667: patch added
Added: jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1667/JCR-1667.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1667/JCR-1667.patch (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1667/JCR-1667.patch 2011-09-15 12:44:37 UTC (rev 4916)
@@ -0,0 +1,23 @@
+Index: exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/hierarchy/impl/NodeHierarchyCreatorImpl.java
+===================================================================
+--- exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/hierarchy/impl/NodeHierarchyCreatorImpl.java (revision 4915)
++++ exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/hierarchy/impl/NodeHierarchyCreatorImpl.java (working copy)
+@@ -241,7 +241,6 @@
+ getSession(sessionProvider, currentRepo, currentRepo.getConfiguration().getDefaultWorkspaceName());
+ Node rootNode = session.getRootNode();
+ String publicApplication = getJcrPath(PUBLIC_APPLICATION);
+- session.logout();
+ return rootNode.getNode(publicApplication.substring(1, publicApplication.length()));
+ }
+
+@@ -262,10 +261,6 @@
+ userNode = usersNode.addNode(userName);
+ usersNode.save();
+ }
+- finally
+- {
+- session.logout();
+- }
+ return userNode;
+ }
+
14 years, 7 months
exo-jcr SVN: r4915 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-09-15 05:55:10 -0400 (Thu, 15 Sep 2011)
New Revision: 4915
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
Log:
EXOJCR-1537: fix dbcleaning for mssql on multidb
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2011-09-15 08:56:47 UTC (rev 4914)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2011-09-15 09:55:10 UTC (rev 4915)
@@ -170,7 +170,7 @@
return new DBClean(jdbcConn, cleanScripts, new DBCleanHelper(jdbcConn, selectItems, deleteItems));
}
- cleanScripts.add("delete from JCR_MITEM where JCR_MITEM.name <> '" + Constants.ROOT_PARENT_NAME + "'");
+ cleanScripts.add("delete from JCR_MITEM where JCR_MITEM.NAME <> '" + Constants.ROOT_PARENT_NAME + "'");
}
else
{
14 years, 7 months
exo-jcr SVN: r4914 - in jcr/trunk: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms and 7 other directories.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-09-15 04:56:47 -0400 (Thu, 15 Sep 2011)
New Revision: 4914
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DataRestoreContext.java
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/JdbcBackupable.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/Backupable.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/RdbmsWorkspaceInitializer.java
Log:
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/Backupable.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/Backupable.java 2011-09-14 14:35:27 UTC (rev 4913)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/Backupable.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.backup;
+import org.exoplatform.services.jcr.impl.backup.rdbms.DataRestoreContext;
+
import java.io.File;
/**
@@ -47,11 +49,11 @@
/**
* Get data restorer to support atomic restore.
*
- * @param storageDir
- * the directory where backup is stored
+ * @param context
+ * the context
* @throws RestoreException
* if any exception occurred
*/
- DataRestore getDataRestorer(File storageDir) throws BackupException;
+ DataRestore getDataRestorer(DataRestoreContext context) throws BackupException;
}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/JdbcBackupable.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/JdbcBackupable.java 2011-09-14 14:35:27 UTC (rev 4913)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/JdbcBackupable.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.backup;
-
-import java.io.File;
-import java.sql.Connection;
-
-/**
- * @author <a href="mailto:anatoliy.bazko@gmail.com">Anatoliy Bazko</a>
- * @version $Id: Backupable.java 34360 2009-07-22 23:58:59Z tolusha $
- */
-public interface JdbcBackupable extends Backupable
-{
-
- /**
- * Get data restorer to support atomic restore.
- *
- * @param storageDir
- * the directory where backup is stored
- * @param jdbcConn
- * the connection to database
- * @throws RestoreException
- * if any exception occurred
- */
- DataRestore getDataRestorer(File storageDir, Connection jdbcConn) throws BackupException;
-
-}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DataRestoreContext.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DataRestoreContext.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DataRestoreContext.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2003-2011 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.backup.rdbms;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2011
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id: DBRestoreContext.java 111 2011-11-11 11:11:11Z rainf0x $
+ */
+public class DataRestoreContext
+{
+
+ public static final String STORAGE_DIR = "storage-dir";
+
+ public static final String DB_CONNECTION = "db-connection";
+
+ public static final String DB_CLEANER = "db-cleaner";
+
+ /**
+ * Context objects.
+ */
+ private Map<String, Object> objects = new HashMap<String, Object>();
+
+ /**
+ * Constructor.
+ *
+ * @param names
+ * the array with names
+ * @param objects
+ * the array with objects
+ */
+ public DataRestoreContext(String[] names, Object[] objects)
+ {
+ for (int i = 0; i < names.length; i++)
+ {
+ this.objects.put(names[i], objects[i]);
+ }
+ }
+
+ /**
+ * Getting object from context.
+ *
+ * @param objectName
+ * String, name of object.
+ * @return Object, if object is not contains in context will be throws RuntimeException.
+ *
+ */
+ public Object getObject(String objectName)
+ {
+ return objects.get(objectName);
+ }
+}
Property changes on: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DataRestoreContext.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java 2011-09-14 14:35:27 UTC (rev 4913)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -41,6 +41,7 @@
import org.exoplatform.services.jcr.impl.backup.DataRestore;
import org.exoplatform.services.jcr.impl.backup.DummyDataRestore;
import org.exoplatform.services.jcr.impl.backup.rdbms.DBBackup;
+import org.exoplatform.services.jcr.impl.backup.rdbms.DataRestoreContext;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.lock.LockRemover;
import org.exoplatform.services.jcr.impl.core.lock.LockRemoverHolder;
@@ -827,14 +828,15 @@
/**
* {@inheritDoc}
*/
- public DataRestore getDataRestorer(File storageDir) throws BackupException
+ public DataRestore getDataRestorer(DataRestoreContext context) throws BackupException
{
List<LockData> locks = new ArrayList<LockData>();
ObjectInputStream in = null;
try
{
- File contentFile = new File(storageDir, "CacheLocks" + DBBackup.CONTENT_FILE_SUFFIX);
+ File contentFile = new File((File)context.getObject(DataRestoreContext.STORAGE_DIR),
+ "CacheLocks" + DBBackup.CONTENT_FILE_SUFFIX);
// it is possible that backup was created on configuration without Backupable WorkspaceLockManager class
if (!PrivilegedFileHelper.exists(contentFile))
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-09-14 14:35:27 UTC (rev 4913)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -54,6 +54,7 @@
import org.exoplatform.services.jcr.impl.backup.ResumeException;
import org.exoplatform.services.jcr.impl.backup.SuspendException;
import org.exoplatform.services.jcr.impl.backup.Suspendable;
+import org.exoplatform.services.jcr.impl.backup.rdbms.DataRestoreContext;
import org.exoplatform.services.jcr.impl.backup.rdbms.DirectoryRestore;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.NamespaceRegistryImpl;
@@ -1593,11 +1594,11 @@
/**
* {@inheritDoc}}
*/
- public DataRestore getDataRestorer(File storageDir) throws BackupException
+ public DataRestore getDataRestorer(DataRestoreContext context) throws BackupException
{
try
{
- File backupDir = new File(storageDir, getStorageName());
+ File backupDir = new File((File) context.getObject(DataRestoreContext.STORAGE_DIR), getStorageName());
if (!PrivilegedFileHelper.exists(backupDir))
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2011-09-14 14:35:27 UTC (rev 4913)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -45,6 +45,7 @@
import org.exoplatform.services.jcr.impl.backup.BackupException;
import org.exoplatform.services.jcr.impl.backup.Backupable;
import org.exoplatform.services.jcr.impl.backup.DataRestore;
+import org.exoplatform.services.jcr.impl.backup.rdbms.DataRestoreContext;
import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
@@ -1527,7 +1528,7 @@
/**
* {@inheritDoc}
*/
- public DataRestore getDataRestorer(File storageDir) throws BackupException
+ public DataRestore getDataRestorer(DataRestoreContext context) throws BackupException
{
return new DataRestore()
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-09-14 14:35:27 UTC (rev 4913)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -46,6 +46,7 @@
import org.exoplatform.services.jcr.impl.backup.BackupException;
import org.exoplatform.services.jcr.impl.backup.Backupable;
import org.exoplatform.services.jcr.impl.backup.DataRestore;
+import org.exoplatform.services.jcr.impl.backup.rdbms.DataRestoreContext;
import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
@@ -59,8 +60,8 @@
import org.jboss.cache.CacheStatus;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
+import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import org.jboss.cache.jmx.JmxRegistrationManager;
import org.jboss.cache.notifications.annotation.NodeModified;
@@ -2016,7 +2017,7 @@
/**
* {@inheritDoc}
*/
- public DataRestore getDataRestorer(File storageDir) throws BackupException
+ public DataRestore getDataRestorer(DataRestoreContext context) throws BackupException
{
return new DataRestore()
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-09-14 14:35:27 UTC (rev 4913)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -29,11 +29,12 @@
import org.exoplatform.services.jcr.dataflow.serialization.ObjectWriter;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.backup.BackupException;
+import org.exoplatform.services.jcr.impl.backup.Backupable;
import org.exoplatform.services.jcr.impl.backup.ComplexDataRestore;
import org.exoplatform.services.jcr.impl.backup.DataRestore;
-import org.exoplatform.services.jcr.impl.backup.JdbcBackupable;
import org.exoplatform.services.jcr.impl.backup.rdbms.DBBackup;
import org.exoplatform.services.jcr.impl.backup.rdbms.DBRestore;
+import org.exoplatform.services.jcr.impl.backup.rdbms.DataRestoreContext;
import org.exoplatform.services.jcr.impl.backup.rdbms.DirectoryRestore;
import org.exoplatform.services.jcr.impl.backup.rdbms.RestoreTableRule;
import org.exoplatform.services.jcr.impl.backup.rdbms.SybaseDBRestore;
@@ -96,7 +97,7 @@
* @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
* @version $Id:GenericWorkspaceDataContainer.java 13433 2007-03-15 16:07:23Z peterit $
*/
-public class JDBCWorkspaceDataContainer extends WorkspaceDataContainerBase implements Startable, JdbcBackupable,
+public class JDBCWorkspaceDataContainer extends WorkspaceDataContainerBase implements Startable, Backupable,
Reindexable
{
@@ -1157,7 +1158,7 @@
/**
* {@inheritDoc}
*/
- public DataRestore getDataRestorer(File storageDir, Connection jdbcConn) throws BackupException
+ public DataRestore getDataRestorer(DataRestoreContext context) throws BackupException
{
List<DataRestore> restorers = new ArrayList<DataRestore>();
@@ -1165,8 +1166,33 @@
ObjectReader backupInfo = null;
try
{
+ File storageDir = (File) context.getObject(DataRestoreContext.STORAGE_DIR);
+ Connection jdbcConn = null;
+
+ if (context.getObject(DataRestoreContext.DB_CONNECTION) == null)
+ {
+ try
+ {
+ jdbcConn = connFactory.getJdbcConnection();
+ jdbcConn.setAutoCommit(false);
+ }
+ catch (SQLException e)
+ {
+ throw new BackupException(e);
+ }
+ catch (RepositoryException e)
+ {
+ throw new BackupException(e);
+ }
+
+ }
+ else
+ {
+ jdbcConn = (Connection) context.getObject(DataRestoreContext.DB_CONNECTION);
+ }
+
backupInfo =
- new ObjectReaderImpl(PrivilegedFileHelper.fileInputStream(new File(storageDir,
+ new ObjectReaderImpl(PrivilegedFileHelper.fileInputStream(new File(storageDir,
"JDBCWorkspaceDataContainer.info")));
String srcContainerName = backupInfo.readString();
@@ -1368,28 +1394,6 @@
/**
* {@inheritDoc}
*/
- public DataRestore getDataRestorer(File storageDir) throws BackupException
- {
- try
- {
- Connection jdbcConn = connFactory.getJdbcConnection();
- jdbcConn.setAutoCommit(false);
-
- return getDataRestorer(storageDir, jdbcConn);
- }
- catch (SQLException e)
- {
- throw new BackupException(e);
- }
- catch (RepositoryException e)
- {
- throw new BackupException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
public NodeDataIndexingIterator getNodeDataIndexingIterator(int pageSize) throws RepositoryException
{
if (isReindexingSupport())
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java 2011-09-14 14:35:27 UTC (rev 4913)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -30,7 +30,7 @@
import org.exoplatform.services.jcr.impl.backup.Backupable;
import org.exoplatform.services.jcr.impl.backup.DataRestore;
import org.exoplatform.services.jcr.impl.backup.JCRRestore;
-import org.exoplatform.services.jcr.impl.backup.JdbcBackupable;
+import org.exoplatform.services.jcr.impl.backup.rdbms.DataRestoreContext;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
@@ -116,17 +116,25 @@
File fullBackupDir =
JCRRestore.getFullBackupFile(workspacesMapping.get(wEntry.getName()).getBackupConfig().getBackupDir());
+
+ DataRestoreContext context;
+ if (jdbcConn != null)
+ {
+ context = new DataRestoreContext(
+ new String[] {DataRestoreContext.STORAGE_DIR, DataRestoreContext.DB_CONNECTION},
+ new Object[] {fullBackupDir, jdbcConn});
+ }
+ else
+ {
+ context = new DataRestoreContext(
+ new String[] {DataRestoreContext.STORAGE_DIR},
+ new Object[] {fullBackupDir});
+ }
+
for (Backupable component : backupable)
{
- if (component instanceof JdbcBackupable && jdbcConn != null)
- {
- dataRestorer.add(((JdbcBackupable)component).getDataRestorer(fullBackupDir, jdbcConn));
- }
- else
- {
- dataRestorer.add(component.getDataRestorer(fullBackupDir));
- }
+ dataRestorer.add(component.getDataRestorer(context));
}
}
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java 2011-09-14 14:35:27 UTC (rev 4913)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -28,6 +28,7 @@
import org.exoplatform.services.jcr.impl.backup.Backupable;
import org.exoplatform.services.jcr.impl.backup.DataRestore;
import org.exoplatform.services.jcr.impl.backup.JCRRestore;
+import org.exoplatform.services.jcr.impl.backup.rdbms.DataRestoreContext;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.log.ExoLogger;
@@ -92,11 +93,15 @@
.getComponentInstancesOfType(Backupable.class);
File storageDir = backupChainLog.getBackupConfig().getBackupDir();
+ File fullBackupDir = JCRRestore.getFullBackupFile(storageDir);
+ DataRestoreContext context = new DataRestoreContext(
+ new String[] {DataRestoreContext.STORAGE_DIR},
+ new Object[] {fullBackupDir});
+
for (Backupable component : backupable)
{
- File fullBackupDir = JCRRestore.getFullBackupFile(storageDir);
- dataRestorer.add(component.getDataRestorer(fullBackupDir));
+ dataRestorer.add(component.getDataRestorer(context));
}
for (DataRestore restorer : dataRestorer)
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/RdbmsWorkspaceInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/RdbmsWorkspaceInitializer.java 2011-09-14 14:35:27 UTC (rev 4913)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/RdbmsWorkspaceInitializer.java 2011-09-15 08:56:47 UTC (rev 4914)
@@ -29,6 +29,7 @@
import org.exoplatform.services.jcr.impl.backup.BackupException;
import org.exoplatform.services.jcr.impl.backup.Backupable;
import org.exoplatform.services.jcr.impl.backup.DataRestore;
+import org.exoplatform.services.jcr.impl.backup.rdbms.DataRestoreContext;
import org.exoplatform.services.jcr.impl.core.BackupWorkspaceInitializer;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.NamespaceRegistryImpl;
@@ -168,10 +169,14 @@
}
}
+ DataRestoreContext context = new DataRestoreContext(
+ new String[] {DataRestoreContext.STORAGE_DIR},
+ new Object[] {new File(restorePath)});
+
// restore all components
for (Backupable component : backupableComponents)
{
- dataRestorers.add(component.getDataRestorer(new File(restorePath)));
+ dataRestorers.add(component.getDataRestorer(context));
}
for (DataRestore restorer : dataRestorers)
14 years, 7 months
exo-jcr SVN: r4913 - in jcr/trunk: exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-09-14 10:35:27 -0400 (Wed, 14 Sep 2011)
New Revision: 4913
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml
Log:
EXOJCR-1507: Improve RDBMS reindexing for DB2
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2011-09-14 14:16:32 UTC (rev 4912)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2011-09-14 14:35:27 UTC (rev 4913)
@@ -138,6 +138,6 @@
@Override
public boolean isReindexingSupport()
{
- return false;
+ return true;
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2011-09-14 14:16:32 UTC (rev 4912)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2011-09-14 14:35:27 UTC (rev 4913)
@@ -72,10 +72,9 @@
FIND_NODES_AND_PROPERTIES =
"select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_MVALUE V, JCR_MITEM P"
- + " join (select A.* from"
- + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_MITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+ + " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_MITEM I"
+ + " where I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ?,?) J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
}
/**
@@ -93,8 +92,9 @@
findNodesAndProperties.clearParameters();
}
- findNodesAndProperties.setInt(1, offset + limit);
+ findNodesAndProperties.setString(1, lastNodeId);
findNodesAndProperties.setInt(2, offset);
+ findNodesAndProperties.setInt(3, limit);
return findNodesAndProperties.executeQuery();
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2011-09-14 14:16:32 UTC (rev 4912)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2011-09-14 14:35:27 UTC (rev 4913)
@@ -72,10 +72,8 @@
FIND_NODES_AND_PROPERTIES =
"select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
- + " join (select A.* from"
- + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_SITEM I where I.CONTAINER_NAME=? and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
- + ") J on P.PARENT_ID = J.ID"
+ + " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_SITEM I"
+ + " where I.CONTAINER_NAME=? AND I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ?,?) J on P.PARENT_ID = J.ID"
+ " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
}
@@ -95,9 +93,10 @@
}
findNodesAndProperties.setString(1, containerName);
- findNodesAndProperties.setInt(2, offset + limit);
+ findNodesAndProperties.setString(2, lastNodeId);
findNodesAndProperties.setInt(3, offset);
- findNodesAndProperties.setString(4, containerName);
+ findNodesAndProperties.setInt(4, limit);
+ findNodesAndProperties.setString(5, containerName);
return findNodesAndProperties.executeQuery();
}
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml 2011-09-14 14:16:32 UTC (rev 4912)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml 2011-09-14 14:35:27 UTC (rev 4913)
@@ -215,8 +215,16 @@
improved by setting the parameter "enable_seqscan" to "off" or
"default_statistics_target" to at least "50" in the configuration of
your database. Then you need to restart DB server and make analyze of
- the JCR_SVALUE (JCR_MVALUE) table.</para>
+ the JCR_SVALUE (or JCR_MVALUE) table.</para>
</note>
+
+ <note>
+ <para>If you use DB2 and the parameter rdbms-reindexing is set to
+ true, the performance of the queiries used while indexing can be
+ improved by making statisticks on tables by running "RUNSTATS ON TABLE
+ <scheme>.<table> WITH DISTRIBUTION AND INDEXES ALL" for
+ JCR_SITEM (or JCR_MITEM) and JCR_SVALUE (or JCR_MVALUE) tables.</para>
+ </note>
</section>
<section>
14 years, 7 months
exo-jcr SVN: r4912 - jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2011-09-14 10:16:32 -0400 (Wed, 14 Sep 2011)
New Revision: 4912
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml
Log:
EXOJCR-1505 : documentation added
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml 2011-09-14 14:11:24 UTC (rev 4911)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml 2011-09-14 14:16:32 UTC (rev 4912)
@@ -107,6 +107,7 @@
<property name="rdbms-reindexing" value="true" />
<property name="reindexing-page-size" value="1000" />
<property name="index-recovery-mode" value="from-coordinator" />
+ <property name="index-recovery-filter" value="org.exoplatform.services.jcr.impl.core.query.lucene.DocNumberRecoveryFilter" />
</properties>
</query-handler>
</workspace>
@@ -196,6 +197,14 @@
been set to <command>from-coordinator</command>, the index will
be retrieved from coordinator</entry>
</row>
+
+ <row>
+ <entry>index-recovery-filter</entry>
+
+ <entry>Defines implementation class or classes of
+ RecoveryFilters, the mechanism of index synchronization for
+ Local Index strategy.</entry>
+ </row>
</tbody>
</tgroup>
</table>
@@ -284,6 +293,69 @@
</query-handler>
</workspace>
</programlisting>
+
+ <section>
+ <title>Local Index Recovery Filters</title>
+
+ <para>Common usecase for all cluster-ready applications is a hot
+ joining and leaving of processing units. Node that is joining cluster
+ for the first time or node joining after some downtime, they all must
+ be in a synchronized state. When having a deal with shared value
+ storages, databases and indexes, cluster nodes are synchronized
+ anytime. But it's an issue when local index strategy used. If new node
+ joins cluster, having no index it is retrieved or recreated. Node can
+ be restarted also and thus index not empty. By default existing index
+ is thought to be actual, but can be outdated. JCR offers a mechanism
+ called RecoveryFilters that will automatically retrieve index for the
+ joining node on startup. This feature is a set of filters that can be
+ defined via QueryHandler configuration:</para>
+
+ <programlisting language="xml"><property name="index-recovery-filter" value="org.exoplatform.services.jcr.impl.core.query.lucene.DocNumberRecoveryFilter" /></programlisting>
+
+ <para>Filter number is not limited so they can be combined:</para>
+
+ <programlisting language="xml"><property name="index-recovery-filter" value="org.exoplatform.services.jcr.impl.core.query.lucene.DocNumberRecoveryFilter" />
+<property name="index-recovery-filter" value="org.exoplatform.services.jcr.impl.core.query.lucene.SystemPropertyRecoveryFilter" />
+</programlisting>
+
+ <para>If any one returns fires, the index is re-synchronized. This
+ feature uses standard index recovery mode defined by previously
+ described parameter (can be "from-indexing" (default) or
+ "from-coordinator")</para>
+
+ <programlisting language="xml"><property name="index-recovery-mode" value="from-coordinator" />
+</programlisting>
+
+ <para>There are couple implementations of filters: </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>org.exoplatform.services.jcr.impl.core.query.lucene.DummyRecoveryFilter:
+ always returns true, for cases when index must be force
+ resynchronized (recovered) each time;</para>
+ </listitem>
+
+ <listitem>
+ <para>org.exoplatform.services.jcr.impl.core.query.lucene.SystemPropertyRecoveryFilter
+ : return value of system property
+ "org.exoplatform.jcr.recoveryfilter.forcereindexing". So index
+ recovery can be controlled from the top without changing
+ documentation using system properties;</para>
+ </listitem>
+
+ <listitem>
+ <para>org.exoplatform.services.jcr.impl.core.query.lucene.DocNumberRecoveryFilter
+ : checks number of documents in index on coordinator side and
+ self-side. Return true if differs. Advantage of this filter
+ comparing to other, it will skip reindexing for workspaces where
+ index wasn't modified. I.e. there is 10 repositories with 3
+ workspaces in each one. Only one is really heavily used in cluster
+ : frontend/production. So using this filter will only reindex
+ those workspaces that are really changed, without affecting other
+ indexes thus greatly reducing startup time. </para>
+ </listitem>
+ </itemizedlist>
+ </section>
</section>
<section>
14 years, 7 months
exo-jcr SVN: r4911 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query: ispn and 1 other directories.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2011-09-14 10:11:24 -0400 (Wed, 14 Sep 2011)
New Revision: 4911
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/LocalIndexMarker.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexChangesFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/LocalIndexChangesFilter.java
Log:
EXOJCR-1505 : Define index strategy by using an interface marker.
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/LocalIndexMarker.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/LocalIndexMarker.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/LocalIndexMarker.java 2011-09-14 14:11:24 UTC (rev 4911)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.core.query;
+
+/**
+ * An empty interface notifying that changes filter implements LocalIndex cluster-ready
+ * strategy. This can be used to check if recovery filters should be used.
+ *
+ * @author <a href="mailto:nzamosenchuk@exoplatform.com">Nikolay Zamosenchul</a>
+ * @version $Id: LocalIndexChangesFilterMarker.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
+ */
+public interface LocalIndexMarker
+{
+
+}
Property changes on: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/LocalIndexMarker.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-09-14 08:29:13 UTC (rev 4910)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-09-14 14:11:24 UTC (rev 4911)
@@ -756,11 +756,24 @@
// Recovery Filters are
String changesFilterClassName = config.getParameterValue(QueryHandlerParams.PARAM_CHANGES_FILTER_CLASS, null);
+ boolean recoveryFilterUsed = false;
- boolean recoveryFilterUsed =
- (org.exoplatform.services.jcr.impl.core.query.ispn.LocalIndexChangesFilter.class.getName().equals(
- changesFilterClassName) || org.exoplatform.services.jcr.impl.core.query.jbosscache.LocalIndexChangesFilter.class
- .getName().equals(changesFilterClassName)) ? true : false;
+ if (changesFilterClassName != null)
+ {
+ try
+ {
+ Class<?> changesFilterClass = Class.forName(changesFilterClassName);
+ // Set recoveryFilterUsed, if changes filter implements LocalIndex strategy
+ if (changesFilterClass != null)
+ {
+ recoveryFilterUsed = LocalIndexMarker.class.isAssignableFrom(changesFilterClass);
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new RepositoryConfigurationException(e.getMessage(), e);
+ }
+ }
QueryHandlerContext context =
new QueryHandlerContext(container, itemMgr, indexingTree, nodeTypeDataManager, nsReg, parentHandler,
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexChangesFilter.java 2011-09-14 08:29:13 UTC (rev 4910)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/LocalIndexChangesFilter.java 2011-09-14 14:11:24 UTC (rev 4911)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
import org.exoplatform.services.jcr.impl.core.query.IndexingTree;
+import org.exoplatform.services.jcr.impl.core.query.LocalIndexMarker;
import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
@@ -52,7 +53,7 @@
* @author <a href="mailto:anatoliy.bazko@gmail.com">Anatoliy Bazko</a>
* @version $Id: LocalIndexChangesFilter.java 34360 2009-07-22 23:58:59Z tolusha $
*/
-public class LocalIndexChangesFilter extends IndexerChangesFilter
+public class LocalIndexChangesFilter extends IndexerChangesFilter implements LocalIndexMarker
{
/**
* Logger instance for this class
@@ -60,7 +61,7 @@
private final Log log = ExoLogger.getLogger("exo.jcr.component.core.LocalIndexChangesFilter");
public static final String PARAM_INFINISPAN_CACHESTORE_CLASS = "infinispan-cachestore-classname";
-
+
private final Cache<Serializable, Object> cache;
private final String wsId;
@@ -99,7 +100,7 @@
handler.init();
}
}
-
+
protected Log getLogger()
{
return log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/LocalIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/LocalIndexChangesFilter.java 2011-09-14 08:29:13 UTC (rev 4910)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/LocalIndexChangesFilter.java 2011-09-14 14:11:24 UTC (rev 4911)
@@ -26,11 +26,12 @@
import org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
import org.exoplatform.services.jcr.impl.core.query.IndexingTree;
+import org.exoplatform.services.jcr.impl.core.query.LocalIndexMarker;
import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory;
+import org.exoplatform.services.jcr.jbosscache.PrivilegedJBossCacheHelper;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory.CacheType;
-import org.exoplatform.services.jcr.jbosscache.PrivilegedJBossCacheHelper;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -61,7 +62,7 @@
* @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
*
*/
-public class LocalIndexChangesFilter extends IndexerChangesFilter
+public class LocalIndexChangesFilter extends IndexerChangesFilter implements LocalIndexMarker
{
/**
* Logger instance for this class
@@ -86,7 +87,7 @@
private final Fqn<String> rootFqn;
private final JmxRegistrationManager jmxManager;
-
+
public static final String LISTWRAPPER = "$lists".intern();
/**
@@ -126,12 +127,14 @@
initCache.getConfiguration().setCacheLoaderConfig(cacheLoaderConfig);
this.rootFqn = Fqn.fromElements(searchManager.getWsId());
this.cache =
- ExoJBossCacheFactory.getUniqueInstance(CacheType.INDEX_CACHE, rootFqn, initCache,
- config.getParameterBoolean(PARAM_JBOSSCACHE_SHAREABLE, PARAM_JBOSSCACHE_SHAREABLE_DEFAULT));
+ ExoJBossCacheFactory.getUniqueInstance(CacheType.INDEX_CACHE, rootFqn, initCache, config.getParameterBoolean(
+ PARAM_JBOSSCACHE_SHAREABLE, PARAM_JBOSSCACHE_SHAREABLE_DEFAULT));
PrivilegedJBossCacheHelper.create(cache);
PrivilegedJBossCacheHelper.start(cache);
- this.jmxManager = ExoJBossCacheFactory.getJmxRegistrationManager(searchManager.getExoContainerContext(), cache, CacheType.INDEX_CACHE);
+ this.jmxManager =
+ ExoJBossCacheFactory.getJmxRegistrationManager(searchManager.getExoContainerContext(), cache,
+ CacheType.INDEX_CACHE);
if (jmxManager != null)
{
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
@@ -172,7 +175,7 @@
String id = IdGenerator.generate();
cache.put(Fqn.fromRelativeElements(rootFqn, id), LISTWRAPPER, changes);
}
-
+
/**
* @see java.lang.Object#finalize()
*/
@@ -191,11 +194,11 @@
return null;
}
});
- }
+ }
}
finally
{
- super.finalize();
+ super.finalize();
}
- }
+ }
}
14 years, 7 months