Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B0DB84E30 for ; Mon, 27 Jun 2011 18:45:17 +0000 (UTC) Received: (qmail 53871 invoked by uid 500); 27 Jun 2011 18:45:17 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 53833 invoked by uid 500); 27 Jun 2011 18:45:17 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 53661 invoked by uid 99); 27 Jun 2011 18:45:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2011 18:45:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2011 18:45:14 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E531223888CB; Mon, 27 Jun 2011 18:44:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1140263 - in /db/derby/code/branches/10.8: ./ java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java Date: Mon, 27 Jun 2011 18:44:52 -0000 To: derby-commits@db.apache.org From: kmarsden@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110627184452.E531223888CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kmarsden Date: Mon Jun 27 18:44:52 2011 New Revision: 1140263 URL: http://svn.apache.org/viewvc?rev=1140263&view=rev Log: ERBY-5289 Unable to boot 10.5.1.1 database - fails during soft/hard upgrade process for a new version number while trying to drop jdbc metadata Checking in testcase for DERBY-5289. In 10.8 theDERBY-3870 fix contributed by Knut Anders Hatlen fixed the issue so no code change is needed. Just the portion of DERBY-3870 that is relevant to DERBY-5289 will be backported to the other branches. Script for testcase contribued by Brett Mason Modified: db/derby/code/branches/10.8/ (props changed) db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java Propchange: db/derby/code/branches/10.8/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Jun 27 18:44:52 2011 @@ -1,2 +1,2 @@ /db/derby/code/branches/10.7:1061570,1061578,1082235 -/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1101059,1101839,1102620,1102826,1103681,1103718,1103742,1125305,1126358,1126468,1127825,1127883,1129136,1129764,1129797,1130077,1130084,1130632,1130895,1131030,1131272,1132546,1132664,1132860,1132928,1133741,1133752,1136371,1136397,1136844,1138201,1138787,1138795 +/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1101059,1101839,1102620,1102826,1103681,1103718,1103742,1125305,1126358,1126468,1127825,1127883,1129136,1129764,1129797,1130077,1130084,1130632,1130895,1131030,1131272,1132546,1132664,1132860,1132928,1133741,1133752,1136371,1136397,1136844,1138201,1138787,1138795,1139449,1139451 Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java?rev=1140263&r1=1140262&r2=1140263&view=diff ============================================================================== --- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java (original) +++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java Mon Jun 27 18:44:52 2011 @@ -1312,5 +1312,79 @@ public class BasicSetup extends UpgradeC s.executeQuery("select * from d3870_t2"), "1"); } } + + /** + * DERBY-5289 Upgrade could fail during upgrade with triggers due to + * failure reading serializable or SQLData object + * @throws SQLException + */ + public void testDERBY5289TriggerUpgradeFormat() throws SQLException { + // if the old version suffers from DERBY-4835 we + // cannot run this test because the database won't boot + // on soft upgrade and none of the fixtures will run. + if (oldSuffersFromDerby4835()) + return; + Statement s = createStatement(); + switch (getPhase()) + { + case PH_CREATE: + s.executeUpdate("CREATE TABLE D5289TABLE1 (COL1 VARCHAR(5))"); + s.executeUpdate("CREATE TABLE D5289TABLE2 (COL2 VARCHAR(5))"); + s.executeUpdate("CREATE TABLE D5289TABLE3 (COL3 VARCHAR(5))"); + s.executeUpdate("CREATE TRIGGER D5289T1_UPDATED AFTER UPDATE " + + "ON D5289TABLE1 REFERENCING OLD AS OLD NEW AS NEW FOR " + + "EACH ROW MODE DB2SQL UPDATE D5289TABLE2 SET COL2 = NEW.COL1 WHERE " + + "COL2 = OLD.COL1"); + s.executeUpdate("CREATE TRIGGER D5289T2_UPDATED AFTER UPDATE " + + "ON D5289TABLE2 REFERENCING NEW AS NEW FOR EACH " + + "ROW MODE DB2SQL INSERT INTO D5289TABLE3(COL3) VALUES('ccc')"); + s.executeUpdate("insert into D5289TABLE1(COL1) values ('aaa') "); + s.executeUpdate("insert into D5289TABLE2(COL2) values ('aaa') "); + s.executeUpdate("UPDATE D5289TABLE1 SET COL1 = 'bbb'"); + assertDERBY5289ResultsAndDelete(); + break; + case PH_SOFT_UPGRADE: + s.executeUpdate("insert into D5289TABLE1(COL1) values ('aaa')"); + s.executeUpdate("insert into D5289TABLE2(COL2) values ('aaa')"); + s.executeUpdate("UPDATE D5289TABLE1 SET COL1 = 'bbb'"); + assertDERBY5289ResultsAndDelete(); + break; + case PH_POST_SOFT_UPGRADE: + // If old version suffers from DERBY-5289, we can't run this part of the + // DERBY-5289 won't go in until 10.8.2.0 + if (! oldLessThan(10,8,2,0)) { + s.executeUpdate("insert into D5289TABLE1(COL1) values ('aaa')"); + s.executeUpdate("insert into D5289TABLE2(COL2) values ('aaa') "); + s.executeUpdate("UPDATE D5289TABLE1 SET COL1 = 'bbb'"); + assertDERBY5289ResultsAndDelete(); + } + break; + case PH_HARD_UPGRADE: + s.executeUpdate("insert into D5289TABLE1(COL1) values ('aaa')"); + s.executeUpdate("insert into D5289TABLE2(COL2) values ('aaa') "); + s.executeUpdate("UPDATE D5289TABLE1 SET COL1 = 'bbb'"); + assertDERBY5289ResultsAndDelete(); + break; + } + } + /** + * Private helper method for fixture testDERBY5289TriggerUpgradeFormat + * to check and cleanup date in each phase. + * + * @throws SQLException + */ + private void assertDERBY5289ResultsAndDelete() throws SQLException { + Statement s = createStatement(); + JDBC.assertFullResultSet(s.executeQuery("SELECT * FROM D5289TABLE1"), + new String[][] {{"bbb"}}); + JDBC.assertFullResultSet(s.executeQuery("SELECT * FROM D5289TABLE2"), + new String[][] {{"bbb"}}); + JDBC.assertFullResultSet(s.executeQuery("SELECT * FROM D5289TABLE3"), + new String[][] {{"ccc"}}); + s.executeUpdate("DELETE FROM D5289TABLE1"); + s.executeUpdate("DELETE FROM D5289TABLE2"); + s.executeUpdate("DELETE FROM D5289TABLE3"); + commit(); + } }