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 ma...@apache.org on 2010/03/01 23:46:40 UTC

svn commit: r917771 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ testing/org/apache/derbyTesting/functionTests/tests/lang/ testing/org/apache/derbyTesting/functionTests/tests/memory/

Author: mamta
Date: Mon Mar  1 22:46:40 2010
New Revision: 917771

URL: http://svn.apache.org/viewvc?rev=917771&view=rev
Log:
DERBY-4538

Committing patch DERBY4538_NoReferencingClause_diff_v2.txt attached to jira DERBY-4538(removed redundant ; as pointed by Knut).

This changes the UPDATE and DELETE statement codes to be little bit smarter when they decide what columns should be part of the read map. Currently, as soon as these 2 nodes find that there are relevant triggers on the table, we decide to read all the columns from the table. With the patch, we will check if all the relevant tiggers have missing REFERENCING clause. If yes, then do not need to read all the columns. Just the columns needed by the UPDATE/DELETE statement. This will get rid of OOM we run into when the table has LOB columns BUT only in the case when the UPDATE/DELETE statement does not reference the LOB column and all the triggers defined on them have missing REFERENCING clause. I have enabled the TriggerTests in lowmem suite with the missing REFERENCING clause cases enabled. For all the other test cases, I simply return from those test cases without actually testing it because we do not have fix for those cases yet. The lowmem suite does not get run regularly and 
 when it is run, as the name indicates, it runs with limited heap. I wanted us to be able to run these tests with default heap as well. To achieve that, I am including the TriggerTests in lang suite too. 

The INSERT table with INSERT triggers work fine already without my changes as long as the INSERT statement does not reference the LOB column. 


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java?rev=917771&r1=917770&r2=917771&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java Mon Mar  1 22:46:40 2010
@@ -33,6 +33,7 @@
 import org.apache.derby.iapi.sql.dictionary.GenericDescriptorList;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;
+import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;
 
 
 import org.apache.derby.iapi.sql.ResultSet;
@@ -70,6 +71,8 @@
 import java.lang.reflect.Modifier;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 import org.apache.derby.iapi.services.io.FormatableProperties;
+
+import java.util.Enumeration;
 import java.util.Vector;
 import java.util.Hashtable;
 import java.util.Properties;
@@ -908,7 +911,15 @@
 	  *	3)	adds the index descriptors to a list of conglomerate
 	  *		descriptors.
 	  *	4)	finds all DELETE triggers on the table
-	  *	5)	if there are any DELETE triggers, marks all columns in the bitmap
+	  *	5)	if there are any DELETE triggers, then do one of the following
+	  *     a)If all of the triggers have MISSING referencing clause, then that
+	  *      means that the trigger actions do not have access to before and
+	  *      after values. In that case, there is no need to blanketly decide 
+	  *      to include all the columns in the read map just because there are
+	  *      triggers defined on the table.
+	  *     b)Since one/more triggers have REFERENCING clause on them, get all
+	  *      the columns because we don't know what the user will ultimately 
+	  *      reference.
 	  *	6)	adds the triggers to an evolving list of triggers
 	  *
 	  *	@param	conglomVector		OUT: vector of affected indices
@@ -952,18 +963,41 @@
 		DMLModStatementNode.getXAffectedIndexes(baseTable,  null, columnMap, conglomVector );
 
 		/*
-	 	** If we have any triggers, then get all the columns
-		** because we don't know what the user will ultimately
-		** reference.
+	 	** If we have any DELETE triggers, then do one of the following
+	 	** 1)If all of the triggers have MISSING referencing clause, then that
+	 	** means that the trigger actions do not have access to before and 
+	 	** after values. In that case, there is no need to blanketly decide to
+	 	** include all the columns in the read map just because there are
+	 	** triggers defined on the table.
+	 	** 2)Since one/more triggers have REFERENCING clause on them, get all 
+	 	** the columns because we don't know what the user will ultimately reference.
 	 	*/
 		baseTable.getAllRelevantTriggers( StatementType.DELETE, (int[])null, relevantTriggers );
-		if ( relevantTriggers.size() > 0 ) { needsDeferredProcessing[0] = true; }
 
 		if (relevantTriggers.size() > 0)
 		{
-			for (int i = 1; i <= columnCount; i++)
-			{
-				columnMap.set(i);
+			needsDeferredProcessing[0] = true;
+			
+			boolean needToIncludeAllColumns = false;
+			Enumeration descs = relevantTriggers.elements();
+			while (descs.hasMoreElements())
+			{
+				TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
+				//Does this trigger have REFERENCING clause defined on it
+				if (!trd.getReferencingNew() && !trd.getReferencingOld())
+					continue;
+				else
+				{
+					needToIncludeAllColumns = true;
+					break;
+				}
+			}
+
+			if (needToIncludeAllColumns) {
+				for (int i = 1; i <= columnCount; i++)
+				{
+					columnMap.set(i);
+				}
 			}
 		}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java?rev=917771&r1=917770&r2=917771&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java Mon Mar  1 22:46:40 2010
@@ -24,25 +24,15 @@
 import org.apache.derby.catalog.DefaultInfo;
 import org.apache.derby.catalog.UUID;
 
-import org.apache.derby.iapi.services.context.ContextManager;
-
-import org.apache.derby.iapi.services.loader.GeneratedMethod;
-
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
 import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
 import org.apache.derby.iapi.sql.conn.Authorizer;
 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.impl.sql.execute.FKInfo;
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.sql.compile.CompilerContext;
-import org.apache.derby.iapi.sql.compile.Visitable;
-import org.apache.derby.iapi.sql.compile.Visitor;
-
-import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;
@@ -51,9 +41,9 @@
 import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor;
 import org.apache.derby.iapi.sql.dictionary.CheckConstraintDescriptor;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-import org.apache.derby.iapi.sql.dictionary.IndexRowGenerator;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.dictionary.GenericDescriptorList;
+import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;
 
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
@@ -61,7 +51,6 @@
 import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;
 import org.apache.derby.iapi.sql.execute.ExecRow;
 
-import org.apache.derby.iapi.sql.Activation;
 import org.apache.derby.iapi.sql.ResultSet;
 import org.apache.derby.iapi.sql.StatementType;
 
@@ -77,11 +66,8 @@
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 
 import java.lang.reflect.Modifier;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Enumeration;
 import java.util.HashSet;
-import java.util.Properties;
 import java.util.Vector;
 
 /**
@@ -952,7 +938,15 @@
 	  *	4)	finds all constraints which overlap the updated columns
 	  *		and adds the constrained columns to the bitmap
 	  *	5)	finds all triggers which overlap the updated columns.
-	  *	6)	if there are any triggers, marks all columns in the bitmap
+	  *	6)	if there are any UPDATE triggers, then do one of the following
+	  *     a)If all of the triggers have MISSING referencing clause, then that
+	  *      means that the trigger actions do not have access to before and
+	  *      after values. In that case, there is no need to blanketly decide 
+	  *      to include all the columns in the read map just because there are
+	  *      triggers defined on the table.
+	  *     b)Since one/more triggers have REFERENCING clause on them, get all
+	  *      the columns because we don't know what the user will ultimately 
+	  *      reference.
 	  *	7)	adds the triggers to an evolving list of triggers
 	  *	8)	finds all generated columns whose generation clauses mention
       *        the updated columns and adds all of the mentioned columns
@@ -1045,19 +1039,41 @@
         addGeneratedColumnPrecursors( baseTable, affectedGeneratedColumns, columnMap );
         
 		/*
-	 	** If we have any triggers, then get all the columns
-		** because we don't know what the user will ultimately
-		** reference.
+	 	** If we have any UPDATE triggers, then do one of the following
+	 	** 1)If all of the triggers have MISSING referencing clause, then that
+	 	** means that the trigger actions do not have access to before and 
+	 	** after values. In that case, there is no need to blanketly decide to
+	 	** include all the columns in the read map just because there are
+	 	** triggers defined on the table.
+	 	** 2)Since one/more triggers have REFERENCING clause on them, get all 
+	 	** the columns because we don't know what the user will ultimately reference.
 	 	*/
-
 		baseTable.getAllRelevantTriggers( StatementType.UPDATE, changedColumnIds, relevantTriggers );
-		if ( relevantTriggers.size() > 0 ) { needsDeferredProcessing[0] = true; }
 
 		if (relevantTriggers.size() > 0)
-		{
-			for (int i = 1; i <= columnCount; i++)
+		{ 
+			needsDeferredProcessing[0] = true;
+			
+			boolean needToIncludeAllColumns = false;
+			Enumeration descs = relevantTriggers.elements();
+			while (descs.hasMoreElements())
 			{
-				columnMap.set(i);
+				TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
+				//Does this trigger have REFERENCING clause defined on it
+				if (!trd.getReferencingNew() && !trd.getReferencingOld())
+					continue;
+				else
+				{
+					needToIncludeAllColumns = true;
+					break;
+				}
+			}
+
+			if (needToIncludeAllColumns) {
+				for (int i = 1; i <= columnCount; i++)
+				{
+					columnMap.set(i);
+				}
 			}
 		}
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=917771&r1=917770&r2=917771&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java Mon Mar  1 22:46:40 2010
@@ -59,6 +59,7 @@
         // the nightly runs.
         // suite.addTest(largeCodeGen.suite());
 	  
+		suite.addTest(org.apache.derbyTesting.functionTests.tests.memory.TriggerTests.suite());
 	  suite.addTest(CheckConstraintTest.suite());
         suite.addTest(AnsiTrimTest.suite());
         suite.addTest(AlterTableTest.suite());

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java?rev=917771&r1=917770&r2=917771&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java Mon Mar  1 22:46:40 2010
@@ -19,6 +19,7 @@
 public class TriggerTests extends BaseJDBCTestCase {
 
 	final int lobsize = 300000*1024;
+	boolean isDerby1482Fixed = false;
 	/**
 	 * Insert trigger tests
 	 * ****************
@@ -302,13 +303,16 @@
 	 * @throws SQLException
 	 */
 	public void test1InsertAfterTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 AFTER INSERT on table1 referencing " +
 			"new as n_row for each row " +
 			"insert into table2(id, updates) values (n_row.id, -1)");
 		commit();
-   		runInsertTriggerTest();		       	
+   		runtest2InsertTriggerTest();		       	
 	}
 
 	/**
@@ -319,6 +323,9 @@
 	 * @throws SQLException
 	 */
 	public void test1InsertAfterTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         s.execute("create procedure proc_test1_InsertAfterTrigger_update_table " +
@@ -329,7 +336,7 @@
 			"new as n_row for each row " +
 			"call proc_test1_InsertAfterTrigger_update_table(n_row.id)");
 		commit();
-   		runInsertTriggerTest();		       	
+   		runtest2InsertTriggerTest();		       	
 	}
 
 	/**
@@ -353,6 +360,9 @@
 	 * @throws SQLException
 	 */
 	public void test1DeleteAfterTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 after DELETE on table1 referencing " +
@@ -370,6 +380,9 @@
 	 * @throws SQLException
 	 */
 	public void test1DeleteAfterTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         s.execute("create procedure proc_test1_DeleteAfterTrigger_update_table " +
@@ -418,6 +431,9 @@
 	 * @throws SQLException
 	 */
 	public void test1UpdateAfterTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 after update of status on table1 referencing " +
@@ -435,6 +451,9 @@
 	 * @throws SQLException
 	 */
 	public void test1UpdateAfterTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         s.execute("create procedure proc_test1_UpdateAfterTrigger_update_table " +
@@ -470,13 +489,16 @@
 	 * @throws SQLException
 	 */
 	public void test1InsertBeforeTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 no cascade before INSERT on table1 referencing " +
 			"new as n_row for each row " +
 			"select updates from table2 where table2.id = n_row.id");
 		commit();
-   		runInsertTriggerTest();		       	
+   		runtest2InsertTriggerTest();		       	
 	}
 
 	/**
@@ -487,6 +509,9 @@
 	 * @throws SQLException
 	 */
 	public void test1InsertBeforeTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         s.execute("create procedure proc_test1_InsertBeforeTrigger_select_table " +
@@ -496,7 +521,7 @@
 		s.execute("create trigger trigger1 no cascade before INSERT on table1 referencing " +
 			"new as n_row for each row call proc_test1_InsertBeforeTrigger_select_table(n_row.id)");
 		commit();
-		runInsertTriggerTest();
+		runtest2InsertTriggerTest();
 	}
 	
 	/**
@@ -521,6 +546,9 @@
 	 * @throws SQLException
 	 */
 	public void test1DeleteBeforeTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 no cascade before DELETE on table1 referencing " +
@@ -538,7 +566,10 @@
 	 * @throws SQLException
 	 */
 	public void test1DeleteBeforeTriggerStoredProc() throws SQLException{
-        basicSetup();
+		if (isDerby1482Fixed == false)
+			return;
+		
+       basicSetup();
         Statement s = createStatement();
 
         s.execute("create procedure proc_test1_DeleteBeforeTrigger_select_table " +
@@ -588,6 +619,9 @@
 	 * @throws SQLException
 	 */
 	public void test1UpdateBeforeTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -606,6 +640,9 @@
 	 * @throws SQLException
 	 */
 	public void test1UpdateBeforeTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         s.execute("create procedure proc_test1_UpdateBeforeTrigger_select_table " +
@@ -642,6 +679,9 @@
 	 * @throws SQLException
 	 */
 	public void test2InsertAfterTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -659,7 +699,7 @@
 				"new as n_row for each row " +
 				"insert into table2(id, bl_table2) values (n_row.id, n_row.bl)");
 		commit();
-   		runInsertTriggerTest();
+   		runtest2InsertTriggerTest();
 	}
 
 	/**
@@ -670,6 +710,9 @@
 	 * @throws SQLException
 	 */
 	public void test2DeleteAfterTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         //The default table2 created by basicSetup does not match the 
@@ -713,6 +756,9 @@
 	 * @throws SQLException
 	 */
 	public void test2UpdateAfterTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         //The default table2 created by basicSetup does not match the 
@@ -740,6 +786,9 @@
 	 * @throws SQLException
 	 */
 	public void test2InsertAfterTriggerUpdatedLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -758,7 +807,7 @@
 				"new as n_row for each row " +
 				"update table1 set bl_null=n_row.bl where bl_null is null");
 		commit();
-   		runInsertTriggerTest();
+   		runtest2InsertTriggerTest();
 	}
 
 	/**
@@ -769,6 +818,9 @@
 	 * @throws SQLException
 	 */
 	public void test2UpdateAfterTriggerUpdatedLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -797,6 +849,9 @@
 	 * @throws SQLException
 	 */
 	public void test2InsertBeforeTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         //The default table2 created by basicSetup does not match the 
@@ -813,7 +868,7 @@
 		ps.setInt(1, 1);
         ps.executeUpdate();
 		commit();
-   		runInsertTriggerTest();
+   		runtest2InsertTriggerTest();
 	}
 	
 	/**
@@ -823,6 +878,9 @@
 	 * @throws SQLException
 	 */
 	public void test2DeleteBeforeTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -850,6 +908,9 @@
 	 * @throws SQLException
 	 */
 	public void test2UpdateBeforeTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -888,6 +949,9 @@
 	 * @throws SQLException
 	 */
 	public void test3UpdateAfterTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 after update of bl on table1 referencing " +
@@ -906,6 +970,9 @@
 	 * @throws SQLException
 	 */
 	public void test3UpdateAfterTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 	
@@ -944,6 +1011,9 @@
 	 * @throws SQLException
 	 */
 	public void test3UpdateBeforeTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -962,6 +1032,9 @@
 	 * @throws SQLException
 	 */
 	public void test3UpdateBeforeTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -1007,6 +1080,9 @@
 	 * @throws SQLException
 	 */
 	public void test4UpdateAfterTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
 	    Statement s = createStatement();
 
@@ -1034,6 +1110,9 @@
 	 * @throws SQLException
 	 */ 
 	public void test4UpdateAfterTriggerUpdatedLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -1064,6 +1143,9 @@
 	 * @throws SQLException
 	 */
 	public void test4UpdateBeforeTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
 	    Statement s = createStatement();
 
@@ -1096,7 +1178,7 @@
 		s.execute("create trigger trigger1 AFTER INSERT on table1 " +
 			"insert into table2(id, updates) values (100, -1)");
 		commit();
-   		runInsertTriggerTest();		       	
+   		runtest1InsertTriggerTest();		       	
 	}
 	 
 	/**
@@ -1111,7 +1193,7 @@
 		s.execute("create trigger trigger1 NO CASCADE BEFORE INSERT on table1 " +
 			"select updates from table2 where table2.id = 1");
 		commit();
-   		runInsertTriggerTest();		       	
+   		runtest1InsertTriggerTest();		       	
 	}
 	 
 	/**
@@ -1153,8 +1235,7 @@
 	public void test5UpdateAfterTriggerNoReferencingClause() throws SQLException{
         basicSetup();
         Statement s = createStatement();
-		s.execute("create trigger trigger1 AFTER UPDATE of status on table1 referencing " +
-				"new as n_row for each row " +
+		s.execute("create trigger trigger1 AFTER UPDATE of status on table1 " +
 				"update table2 set updates = updates + 1 where table2.id = 1");
 		commit();
    		runtest1UpdateTrigger();		       	
@@ -1169,21 +1250,32 @@
 	public void test5UpdateBeforeTriggerNoReferencingClause() throws SQLException{
         basicSetup();
         Statement s = createStatement();
-		s.execute("create trigger trigger1 NO CASCADE BEFORE UPDATE of status on table1 referencing " +
-				"new as n_row for each row " +
+		s.execute("create trigger trigger1 NO CASCADE BEFORE UPDATE of status on table1 " +
 				"select updates from table2 where table2.id = 1");
 		commit();
    		runtest1UpdateTrigger();		       	
 	}
+
+	/**
+	 * Following will do an insert into table1 which will cause insert 
+	 * trigger to fire. The insert does not involve the LOB column.
+	 *
+	 * @throws SQLException
+	 */
+	public void runtest1InsertTriggerTest() throws SQLException{
+		PreparedStatement ps = prepareStatement(
+				"insert into table1(id, status) values(101, 0)");
+        ps.executeUpdate();
+        commit();
+	}
 	
 	/**
 	 * Following will do an insert into table1 which will cause insert 
-	 * trigger to fire. 
+	 * trigger to fire. The insert involves the LOB column.
 	 *
 	 * @throws SQLException
 	 */
-	public void runInsertTriggerTest() throws SQLException{
-		System.out.println("Inserting into table1 to cause insert trigger to fire");
+	public void runtest2InsertTriggerTest() throws SQLException{
 		PreparedStatement ps = prepareStatement(
 				"insert into table1(id, status, bl) values(101, 0, ?)");
         ps.setBinaryStream(1, new LoopingAlphabetStream(lobsize), lobsize);
@@ -1193,12 +1285,11 @@
 	
 	/**
 	 * Following will update a row in table1 which will cause update 
-	 * trigger to fire. 
+	 * trigger to fire. The update does not involve the LOB column.
 	 *
 	 * @throws SQLException
 	 */
 	public void runtest1UpdateTrigger() throws SQLException{
-		System.out.println("Updating table1(int) to cause update trigger to fire");
 		PreparedStatement ps = prepareStatement(
 				"update table1 set status = 1 where id = 1");
         ps.executeUpdate();
@@ -1207,12 +1298,11 @@
 	
 	/**
 	 * Following will update a row in table1 which will cause update 
-	 * trigger to fire. 
+	 * trigger to fire. The update involves the LOB column.
 	 *
 	 * @throws SQLException
 	 */
 	public void runtest2UpdateTrigger() throws SQLException{
-		System.out.println("Updating table1(blob column1) to cause update trigger to fire");
 		PreparedStatement ps = prepareStatement(
 				"update table1 set bl = ? where id = 1");
         ps.setBinaryStream(1, new LoopingAlphabetStream(lobsize), lobsize);
@@ -1222,12 +1312,11 @@
 	
 	/**
 	 * Following will update a row in table1 which will cause update 
-	 * trigger to fire. 
+	 * trigger to fire. The update involves the LOB column.
 	 *
 	 * @throws SQLException
 	 */
 	public void runtest3UpdateTrigger() throws SQLException{
-		System.out.println("Updating table1(blob column2) to cause update trigger to fire");
 		PreparedStatement ps = prepareStatement(
 				"update table1 set bl_null=null where id = 1");
         ps.executeUpdate();
@@ -1241,7 +1330,6 @@
 	 * @throws SQLException
 	 */
 	public void runDeleteTriggerTest() throws SQLException{
-		System.out.println("Deleting from table1 to cause delete trigger to fire");
 		PreparedStatement ps = prepareStatement(
 				"delete from table1 where id=1");
         ps.executeUpdate();

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java?rev=917771&r1=917770&r2=917771&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java Mon Mar  1 22:46:40 2010
@@ -35,15 +35,7 @@
 
     public static Test suite() throws Exception{
         TestSuite suite = new TestSuite("Memory Suite");
-        //Disable following TriggerTests until DERBY-1482 has been fixed.
-        //Without that fix, the test will run into OOM errors for all
-        //the test fixtures. This test is written for triggers defined
-        //on table with LOB columns. No matter whether the LoB columns
-        //are touched in the trigger action, it appears that Derby is
-        //streaming the before and after values of LOB columns. Once
-        //the streaming problem has been resolved, we should be able
-        //to uncomment the following test.
-        //suite.addTest(TriggerTests.suite());
+        suite.addTest(TriggerTests.suite());
         suite.addTest(BlobMemTest.suite());
         suite.addTest(ClobMemTest.suite());
         suite.addTest(MultiByteClobTest.suite());