db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1021426 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/catalog/DD_Version.java testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
Date Mon, 11 Oct 2010 16:51:15 GMT
Author: mamta
Date: Mon Oct 11 16:51:15 2010
New Revision: 1021426

URL: http://svn.apache.org/viewvc?rev=1021426&view=rev
Log:
DERBY-4835 Trigger plan does not recompile with upgrade from 10.5.3.0 to 10.6.1.0 causing
java.lang.NoSuchMethodError

The problem was that the clearing of stored statements during the upgrade was conditional.
The clearing should happen unconditionally during upgrade. Unconditional clearing of SPSes
has fixed the problem with this jira. 

Also, added a test in upgrade suite for triggers. The test has been added to BasicSetup.java
which will ensure that this trigger test will automatically get run with even future releases.




Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java

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=1021426&r1=1021425&r2=1021426&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
Oct 11 16:51:15 2010
@@ -518,8 +518,10 @@ public	class DD_Version implements	Forma
 			// SPSes won't be restored.
 			if (fromVersion.majorVersionNumber >= DataDictionary.DD_VERSION_DERBY_10_5)
 				bootingDictionary.updateMetadataSPSes(tc);
-			else
-				bootingDictionary.clearSPSPlans();
+			//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/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java?rev=1021426&r1=1021425&r2=1021426&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
Mon Oct 11 16:51:15 2010
@@ -50,7 +50,46 @@ public class BasicSetup extends UpgradeC
     public BasicSetup(String name) {
         super(name);
     }
-      
+    
+    /**
+     * Simple test of the triggers. Added for DERBY-4835
+     */
+    public void testTriggerBasic() throws SQLException
+    {
+        Statement s = createStatement();
+        switch (getPhase())
+        {
+        case PH_CREATE:
+            s.executeUpdate("CREATE TABLE Trigger_t1 " +
+            		"(c1 INTEGER NOT NULL GENERATED ALWAYS " +
+            		"AS IDENTITY (START WITH 1, INCREMENT BY 1), " +
+            		"max_size INTEGER NOT NULL, "+
+            		"CONSTRAINT c1_pk PRIMARY KEY (c1))");
+            s.executeUpdate("CREATE TABLE Trigger_t2 "+
+            		"(c1 INTEGER DEFAULT 0 NOT NULL)");
+            s.executeUpdate("CREATE TRIGGER gls_blt_trg "+
+            		"AFTER INSERT ON Trigger_t1 FOR EACH ROW MODE DB2SQL "+
+            		"INSERT INTO Trigger_t2(c1) "+
+            		"VALUES ( (select max(c1) from Trigger_t1))");
+            s.executeUpdate("INSERT INTO Trigger_t1(max_size) "+
+            		"VALUES(20)");
+            break;
+        case PH_SOFT_UPGRADE:
+            s.executeUpdate("INSERT INTO Trigger_t1(max_size) "+
+    		"VALUES(20)");
+            break;
+        case PH_POST_SOFT_UPGRADE:
+            s.executeUpdate("INSERT INTO Trigger_t1(max_size) "+
+    		"VALUES(20)");
+            break;
+        case PH_HARD_UPGRADE:
+            s.executeUpdate("INSERT INTO Trigger_t1(max_size) "+
+    		"VALUES(20)");
+            break;
+        }
+        s.close();
+    }
+
     /**
      * Simple test of the old version from the meta data.
      */



Mime
View raw message