From: <tho...@us...> - 2012-07-26 16:31:42
|
Revision: 6395 http://bigdata.svn.sourceforge.net/bigdata/?rev=6395&view=rev Author: thompsonbry Date: 2012-07-26 16:31:31 +0000 (Thu, 26 Jul 2012) Log Message: ----------- AbstractResource#destroy() now passes through a "destroyed" boolean to the resource locator. This is used to clear the read-committed and unisolated views of the resource from the cache. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/AbstractResource.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/locator/DefaultResourceLocator.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/locator/IResourceLocator.java branches/BIGDATA_RELEASE_1_2_0/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/AbstractResource.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/AbstractResource.java 2012-07-26 16:30:44 UTC (rev 6394) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/AbstractResource.java 2012-07-26 16:31:31 UTC (rev 6395) @@ -694,7 +694,7 @@ namespace); // Clear the entry from the resource locator cache. - indexManager.getResourceLocator().discard(this); + indexManager.getResourceLocator().discard(this, true/* destroyed */); } Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/locator/DefaultResourceLocator.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/locator/DefaultResourceLocator.java 2012-07-26 16:30:44 UTC (rev 6394) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/locator/DefaultResourceLocator.java 2012-07-26 16:31:31 UTC (rev 6395) @@ -48,6 +48,7 @@ import com.bigdata.journal.ICommitRecord; import com.bigdata.journal.IIndexManager; import com.bigdata.journal.IIndexStore; +import com.bigdata.journal.ITx; import com.bigdata.journal.Journal; import com.bigdata.journal.TemporaryStore; import com.bigdata.journal.TimestampUtility; @@ -959,18 +960,20 @@ } - public void discard(final ILocatableResource<T> instance) { - + public void discard(final ILocatableResource<T> instance, + final boolean destroyed) { + if (instance == null) throw new IllegalArgumentException(); final String namespace = instance.getNamespace(); - + final long timestamp = instance.getTimestamp(); - + if (log.isInfoEnabled()) { - log.info("namespace=" + namespace + ", timestamp=" + timestamp); + log.info("namespace=" + namespace + ", timestamp=" + timestamp + + ", destroyed=" + destroyed); } @@ -992,7 +995,17 @@ log.info("instance=" + instance + ", found=" + found); } - + + if (destroyed) { + + // Also discard the unisolated view. + resourceCache.remove(new NT(namespace, ITx.UNISOLATED)); + + // Also discard the read-committed view. + resourceCache.remove(new NT(namespace, ITx.READ_COMMITTED)); + + } + } finally { lock.unlock(); Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/locator/IResourceLocator.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/locator/IResourceLocator.java 2012-07-26 16:30:44 UTC (rev 6394) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/relation/locator/IResourceLocator.java 2012-07-26 16:31:31 UTC (rev 6395) @@ -76,7 +76,15 @@ * will be returned from the cache and buffered writes on the indices for * those relations (if they are local index objects) will still be visible, * thus defeating the abort semantics. + * + * @param instance + * The instance whose cached references should be discarded. + * @param destroyed + * <code>true</code> iff the resource was destroyed, in which + * case the read-committed and unisolated views must also be + * discarded even if they do not correspond to the + * <i>instance</i>. */ - public void discard(final ILocatableResource<T> instance); + public void discard(final ILocatableResource<T> instance,boolean destroyed); } Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java 2012-07-26 16:30:44 UTC (rev 6394) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java 2012-07-26 16:31:31 UTC (rev 6395) @@ -2014,7 +2014,7 @@ if (lexiconRelation != null) { - locator.discard(lexiconRelation); + locator.discard(lexiconRelation, false/*destroyed*/); lexiconRelation = null; @@ -2022,7 +2022,7 @@ if (spoRelation != null) { - locator.discard(spoRelation); + locator.discard(spoRelation, false/*destroyed*/); spoRelation = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |