Permalink
Browse files

[bugfix] New range index does compile-time query rewriting. We thus n…

…eed to refresh compiled queries if a collection configuration has been added or removed: clear query cache when collection configuration gets invalidated.
  • Loading branch information...
1 parent 2698cf3 commit 91f8b63cf949eaadad680155e812994be19c07e5 @wolfgangmm wolfgangmm committed Feb 6, 2014
@@ -1092,7 +1092,7 @@ public void removeXMLResource(final Txn transaction, final DBBroker broker, fina
useTriggers = false;
final CollectionConfigurationManager confMgr = broker.getBrokerPool().getConfigurationManager();
if (confMgr != null) {
- confMgr.invalidate(getURI());
+ confMgr.invalidate(getURI(), broker.getBrokerPool());
}
}
@@ -1417,7 +1417,7 @@ private void storeXMLInternal(final Txn transaction, final DBBroker broker, fina
final CollectionConfigurationManager manager = broker.getBrokerPool().getConfigurationManager();
if(manager != null) {
try {
- manager.invalidate(getURI());
+ manager.invalidate(getURI(), broker.getBrokerPool());
manager.loadConfiguration(broker, this);
} catch(final PermissionDeniedException pde) {
throw new EXistException(pde.getMessage(), pde);
@@ -24,6 +24,7 @@
import org.exist.dom.DocumentImpl;
import org.exist.memtree.SAXAdapter;
import org.exist.security.PermissionDeniedException;
+import org.exist.storage.BrokerPool;
import org.exist.storage.DBBroker;
import org.exist.storage.IndexSpec;
import org.exist.storage.lock.Lock;
@@ -390,6 +391,10 @@ public Void call() {
* @param collectionPath
*/
public void invalidate(final XmldbURI collectionPath) {
+ invalidate(collectionPath, null);
+ }
+
+ public void invalidate(final XmldbURI collectionPath, final BrokerPool pool) {
if (!collectionPath.startsWith(CONFIG_COLLECTION_URI)) {
return;
}
@@ -402,8 +407,10 @@ public Void call() {
LOG.debug("Invalidating collection " + collectionPath);
}
- configurations.remove(new CollectionURI(collectionPath.getRawCollectionPath()));
-
+ CollectionConfiguration removed = configurations.remove(new CollectionURI(collectionPath.getRawCollectionPath()));
+ if (removed != null && pool != null) {
+ pool.getXQueryPool().clear();
+ }
return null;
}
});
@@ -1416,7 +1416,7 @@ public boolean removeCollection(final Txn transaction, Collection collection) th
// Notify the collection configuration manager
final CollectionConfigurationManager manager = pool.getConfigurationManager();
if(manager != null) {
- manager.invalidate(uri);
+ manager.invalidate(uri, getBrokerPool());
}
if(LOG.isDebugEnabled()) {
@@ -1776,7 +1776,7 @@ public void reindexCollection(XmldbURI collectionName) throws PermissionDeniedEx
reindexCollection(collection, NodeProcessor.MODE_STORE);
}
- public void reindexCollection(Collection collection, int mode) throws PermissionDeniedException {
+ protected void reindexCollection(Collection collection, int mode) throws PermissionDeniedException {
final TransactionManager transact = pool.getTransactionManager();
final Txn transaction = transact.beginTransaction();
long start = System.currentTimeMillis();
@@ -1799,7 +1799,7 @@ public void reindexCollection(Collection collection, int mode) throws Permission
}
}
- public void reindexCollection(Txn transaction, Collection collection, int mode) throws PermissionDeniedException {
+ protected void reindexCollection(Txn transaction, Collection collection, int mode) throws PermissionDeniedException {
final CollectionCache collectionsCache = pool.getCollectionsCache();
synchronized(collectionsCache) {
if (!collection.getPermissionsNoLock().validate(getSubject(), Permission.WRITE))

0 comments on commit 91f8b63

Please sign in to comment.