You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2013/04/10 21:11:56 UTC
svn commit: r1466630 - in /db/derby/code/branches/10.9: ./
java/engine/org/apache/derby/iapi/sql/dictionary/
java/engine/org/apache/derby/impl/sql/catalog/
java/engine/org/apache/derby/impl/sql/execute/
java/storeless/org/apache/derby/impl/storeless/
Author: rhillegas
Date: Wed Apr 10 19:11:56 2013
New Revision: 1466630
URL: http://svn.apache.org/r1466630
Log:
DERBY-6137: Port 1466481 and 1466522 from trunk to 10.9 branch.
Modified:
db/derby/code/branches/10.9/ (props changed)
db/derby/code/branches/10.9/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/execute/DropSequenceConstantAction.java
db/derby/code/branches/10.9/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
Propchange: db/derby/code/branches/10.9/
------------------------------------------------------------------------------
Merged /db/derby/code/trunk:r1466481,1466522
Modified: db/derby/code/branches/10.9/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java?rev=1466630&r1=1466629&r2=1466630&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java (original)
+++ db/derby/code/branches/10.9/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java Wed Apr 10 19:11:56 2013
@@ -212,6 +212,13 @@ public interface DataDictionary
public static final int DDL_MODE = 1;
/**
+ * Clear the DataDictionary caches, including the sequence caches if requested..
+ *
+ * @exception StandardException Standard Derby error policy
+ */
+ public void clearCaches( boolean clearSequenceCaches ) throws StandardException;
+
+ /**
* Clear all of the DataDictionary caches.
*
* @exception StandardException Standard Derby error policy
Modified: db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=1466630&r1=1466629&r2=1466630&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java (original)
+++ db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java Wed Apr 10 19:11:56 2013
@@ -1304,8 +1304,10 @@ public final class DataDictionaryImpl
/* Switch the caching mode to DDL */
setCacheMode(DataDictionary.DDL_MODE);
- /* Clear out all the caches */
- clearCaches();
+ // Until we implement ALTER SEQUENCE, there should be no need
+ // to clear the sequence cache. Always clearing the sequence cache
+ // here gives rise to DERBY-6137.
+ clearCaches( false );
}
/* Keep track of the number of DDL users */
@@ -9099,11 +9101,21 @@ public final class DataDictionaryImpl
*/
public void clearCaches() throws StandardException
{
+ clearCaches( true );
+ }
+
+ /**
+ * Clear the DataDictionary caches, including the sequence caches if requested..
+ *
+ * @exception StandardException Standard Derby error policy
+ */
+ public void clearCaches( boolean clearSequenceCaches ) throws StandardException
+ {
nameTdCache.cleanAll();
nameTdCache.ageOut();
OIDTdCache.cleanAll();
OIDTdCache.ageOut();
- clearSequenceCaches();
+ if ( clearSequenceCaches ) { clearSequenceCaches(); }
if (spsNameCache != null)
{
//System.out.println("CLEARING SPS CACHE");
@@ -10470,7 +10482,19 @@ public final class DataDictionaryImpl
( schemaName + "." + sequenceName) );
}
- return ((SequenceUpdater) sequenceGeneratorCache.find( uuid )).peekAtCurrentValue();
+ SequenceUpdater sequenceUpdater = null;
+
+ try {
+ sequenceUpdater = (SequenceUpdater) sequenceGeneratorCache.find( uuid );
+ return sequenceUpdater.peekAtCurrentValue();
+ }
+ finally
+ {
+ if ( sequenceUpdater != null )
+ {
+ sequenceGeneratorCache.release( sequenceUpdater );
+ }
+ }
}
public RowLocation getRowLocationTemplate(LanguageConnectionContext lcc,
Modified: db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/execute/DropSequenceConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/execute/DropSequenceConstantAction.java?rev=1466630&r1=1466629&r2=1466630&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/execute/DropSequenceConstantAction.java (original)
+++ db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/execute/DropSequenceConstantAction.java Wed Apr 10 19:11:56 2013
@@ -91,6 +91,7 @@ class DropSequenceConstantAction extends
** the transaction.
*/
dd.startWriting(lcc);
+ dd.clearSequenceCaches();
SequenceDescriptor sequenceDescriptor = dd.getSequenceDescriptor(schemaDescriptor, sequenceName);
@@ -101,6 +102,5 @@ class DropSequenceConstantAction extends
}
sequenceDescriptor.drop(lcc);
-
}
}
Modified: db/derby/code/branches/10.9/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java?rev=1466630&r1=1466629&r2=1466630&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java (original)
+++ db/derby/code/branches/10.9/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java Wed Apr 10 19:11:56 2013
@@ -78,6 +78,8 @@ import org.apache.derby.iapi.types.RowLo
*/
public class EmptyDictionary implements DataDictionary, ModuleSupportable {
+ public void clearCaches( boolean clearSequenceCaches ) {}
+
public void clearCaches() throws StandardException {
// Auto-generated method stub