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 km...@apache.org on 2008/11/10 17:52:37 UTC
svn commit: r712695 - in /db/derby/code/trunk/java:
engine/org/apache/derby/iapi/sql/dictionary/
engine/org/apache/derby/impl/sql/catalog/
storeless/org/apache/derby/impl/storeless/
Author: kmarsden
Date: Mon Nov 10 08:52:36 2008
New Revision: 712695
URL: http://svn.apache.org/viewvc?rev=712695&view=rev
Log:
DERBY-1107 For existing databases JDBC metadata queries do not get updated properly between maintenance versions.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java?rev=712695&r1=712694&r2=712695&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java Mon Nov 10 08:52:36 2008
@@ -1969,4 +1969,14 @@
public boolean existsGrantToAuthid(String authId,
TransactionController tc)
throws StandardException;
+
+
+ /**
+ * Drop and recreate metadata stored prepared statements.
+ *
+ * @param tc the xact
+ * @throws StandardException
+ */
+ public void updateMetadataSPSes(TransactionController tc) throws StandardException;
+
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java?rev=712695&r1=712694&r2=712695&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java Mon Nov 10 08:52:36 2008
@@ -340,8 +340,7 @@
//Drop and recreate the stored versions of the JDBC database metadata queries
//This is to make sure that we have the stored versions of JDBC database
//metadata queries matching with this release of the engine.
- dropJDBCMetadataSPSes(tc, false);
- bootingDictionary.createSystemSps(tc);
+ bootingDictionary.updateMetadataSPSes(tc);
/*
* OLD Cloudscape 5.1 upgrade code, Derby does not support
@@ -450,7 +449,15 @@
boolean isReadOnly = bootingDictionary.af.isReadOnly();
if (!isReadOnly) {
- bootingDictionary.clearSPSPlans();
+ // Once a database is version 10.5 we will start updating metadata SPSes
+ // on any version change,up or down. This will ensure that metadata queries
+ // match the version we are using. We don't want to do this for lower
+ // database versions because on reverting to the previous version the
+ // SPSes won't be restored.
+ if (fromVersion.majorVersionNumber >= DataDictionary.DD_VERSION_DERBY_10_5)
+ bootingDictionary.updateMetadataSPSes(tc);
+ else
+ bootingDictionary.clearSPSPlans();
DD_Version lastRun;
@@ -485,49 +492,7 @@
bootingDictionary.clearCaches();
}
-
- /**
- * Drop all jdbc metadata spses. This
- * it to ensure that we don't have any problems
- * with old metadata queries that have outdated
- * query text (the plans are always cleared out
- * on upgrade time).
- *
- * @param tc the xact
- * @param removeSYSIBMonly if <code>true</code>, remove stored
- * prepared statements in the SYSIBM schema only; otherwise,
- * remove stored prepared statements in all system schemas
- * (including SYSIBM)
- *
- * @exception StandardException Standard Derby error policy.
- */
- protected void dropJDBCMetadataSPSes(TransactionController tc, boolean removeSYSIBMonly)
- throws StandardException
- {
- for (java.util.Iterator it = bootingDictionary.getAllSPSDescriptors().iterator(); it.hasNext(); )
- {
- SPSDescriptor spsd = (SPSDescriptor) it.next();
- SchemaDescriptor sd = spsd.getSchemaDescriptor();
- // need to compare the name, old SYSIBM is not built-in
- boolean isSYSIBM = sd.getSchemaName().equals(SchemaDescriptor.IBM_SYSTEM_SCHEMA_NAME);
-
- // don't drop statements in non-system schemas
- if (!sd.isSystemSchema() && !isSYSIBM) {
- continue;
- }
-
- // don't drop statements outside the SYSIBM schema if
- // we're told not to
- if (removeSYSIBMonly && !isSYSIBM) {
- continue;
- }
-
- bootingDictionary.dropSPSDescriptor(spsd, tc);
- bootingDictionary.dropDependentsStoredDependencies(spsd.getUUID(),
- tc);
- }
- }
-
+
/**
* Make a catalog.
* @param tc TransactionController
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=712695&r1=712694&r2=712695&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java Mon Nov 10 08:52:36 2008
@@ -12295,4 +12295,42 @@
GRANTEE_COL_NUM_IN_GRANTEE_ALIAS_GRANTOR_INDEX) ||
existsRoleGrantByGrantee(authId, tc));
}
+
+
+ /**
+ * Remove metadata stored prepared statements.
+ * @param tc the xact
+ *
+ *
+ */
+ private void dropJDBCMetadataSPSes(TransactionController tc) throws StandardException
+ {
+ for (java.util.Iterator it = getAllSPSDescriptors().iterator(); it.hasNext(); )
+ {
+ SPSDescriptor spsd = (SPSDescriptor) it.next();
+ SchemaDescriptor sd = spsd.getSchemaDescriptor();
+
+ // don't drop statements in non-system schemas
+ if (!sd.isSystemSchema()) {
+ continue;
+ }
+
+ dropSPSDescriptor(spsd, tc);
+ dropDependentsStoredDependencies(spsd.getUUID(), tc);
+
+ }
+ }
+
+
+ /**
+ * Drop and recreate metadata stored prepared statements.
+ *
+ * @param tc the xact
+ * @throws StandardException
+ */
+ public void updateMetadataSPSes(TransactionController tc) throws StandardException {
+ dropJDBCMetadataSPSes(tc);
+ createSystemSps(tc);
+ }
+
}
Modified: db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java?rev=712695&r1=712694&r2=712695&view=diff
==============================================================================
--- db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java (original)
+++ db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java Mon Nov 10 08:52:36 2008
@@ -814,4 +814,8 @@
// TODO Auto-generated method stub
return null;
}
+
+ public void updateMetadataSPSes(TransactionController tc) throws StandardException {
+ // TODO Auto-generated method stub
+ }
}