db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1520320 - in /db/derby/code/branches/10.10: ./ java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
Date Thu, 05 Sep 2013 14:07:59 GMT
Author: kahatlen
Date: Thu Sep  5 14:07:58 2013
New Revision: 1520320

URL: http://svn.apache.org/r1520320
Log:
DERBY-6314: Upgrade from 10.10 fails with ClassCastException

Merged revision 1517533 from trunk.

Modified:
    db/derby/code/branches/10.10/   (props changed)
    db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java

Propchange: db/derby/code/branches/10.10/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1517533

Modified: db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java?rev=1520320&r1=1520319&r2=1520320&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
(original)
+++ db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
Thu Sep  5 14:07:58 2013
@@ -549,6 +549,13 @@ public	class DD_Version implements	Forma
 		boolean isReadOnly = bootingDictionary.af.isReadOnly();
 
 		if (!isReadOnly) {
+            // Make sure all stored plans are cleared, both for triggers and
+            // for metadata queries. The plans will be recompiled automatically
+            // on the first execution after upgrade. We clear the plans because
+            // the stored format may have changed between the versions, so it
+            // might not be possible to read or execute them in this version.
+            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 
@@ -556,10 +563,6 @@ public	class DD_Version implements	Forma
 			// SPSes won't be restored.
 			if (fromVersion.majorVersionNumber >= DataDictionary.DD_VERSION_DERBY_10_5)
 				bootingDictionary.updateMetadataSPSes(tc);
-			//Following make sure that the stored plans (including the ones for
-			//triggers) will get cleared during upgrade and hence we will not
-			//hold on to stale plans.
-			bootingDictionary.clearSPSPlans();
 
 			DD_Version lastRun;
 			

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java?rev=1520320&r1=1520319&r2=1520320&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
Thu Sep  5 14:07:58 2013
@@ -1947,4 +1947,15 @@ public class BasicSetup extends UpgradeC
         s.executeUpdate("DELETE FROM D5289TABLE3");
         commit();  
     }
+
+    /**
+     * Regression test case for DERBY-6314, which caused upgrade to fail if a
+     * metadata query had been executed with the old version of the database.
+     */
+    public void testDERBY6314() throws SQLException {
+        // Simply execute a metadata query. The query itself did not use to
+        // fail, but it caused PhaseChanger to fail when moving to the
+        // PH_SOFT_UPGRADE phase or the PH_HARD_UPGRADE phase.
+        JDBC.assertDrainResults(getConnection().getMetaData().getSchemas());
+    }
 }



Mime
View raw message