db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1301621 - in /db/derby/code/branches/10.6: ./ java/engine/org/apache/derby/impl/sql/execute/ java/testing/org/apache/derbyTesting/functionTests/tests/memory/
Date Fri, 16 Mar 2012 16:10:11 GMT
Author: kmarsden
Date: Fri Mar 16 16:10:11 2012
New Revision: 1301621

URL: http://svn.apache.org/viewvc?rev=1301621&view=rev
Log:
DERBY-3009 Out of memory error when creating a very large table

Contributed by Knut Anders Hatlen. Merge revision 1086527 from trunk 


Added:
    db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/memory/Derby3009Test.java
      - copied unchanged from r1086527, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/Derby3009Test.java
Modified:
    db/derby/code/branches/10.6/   (props changed)
    db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
    db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java

Propchange: db/derby/code/branches/10.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Mar 16 16:10:11 2012
@@ -1,4 +1,4 @@
 /db/derby/code/branches/10.7:1140196,1294731
 /db/derby/code/branches/10.8:1209227-1209228,1209284
-/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,942286,942476,942480,942587,944152,946794,948045,948069,951346,951366,952138,952237,952581,954344,954421,954544,954748,955001,955540,955634,956075,956234,956445,956569,956659,957260,957902,958163,958257,958264,958508,958522,958555,958618,958939,959550,961892,962716,963206,963705,964039,964115,964402,965647,966393,967201,967304,980089,980684,986689,986834,987539,989099,990292,997325,998170,999119,999479,999485,1002291,1002682,1002853,1021426,1024511,1024528,1025615,1025795,1028716,1030043,1033485,1033864,1035164,1038514,1040658,1053724,1055169,1062096,1063809,1065061,1067250,1069661,1071886,1078461,1081455,1097247,1103681,1103718,1136363,1138341,1138444,1141924,1164370,1203050,1207729,1208775,1293494,1294512
+/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,942286,942476,942480,942587,944152,946794,948045,948069,951346,951366,952138,952237,952581,954344,954421,954544,954748,955001,955540,955634,956075,956234,956445,956569,956659,957260,957902,958163,958257,958264,958508,958522,958555,958618,958939,959550,961892,962716,963206,963705,964039,964115,964402,965647,966393,967201,967304,980089,980684,986689,986834,987539,989099,990292,997325,998170,999119,999479,999485,1002291,1002682,1002853,1021426,1024511,1024528,1025615,1025795,1028716,1030043,1033485,1033864,1035164,1038514,1040658,1053724,1055169,1062096,1063809,1065061,1067250,1069661,1071886,1078461,1081455,1086527,1097247,1103681,1103718,1136363,1138341,1138444,1141924,1164370,1203050,1207729,1208775,1293494,1294512
 /db/derby/docs/trunk:954344

Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java?rev=1301621&r1=1301620&r2=1301621&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
(original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
Fri Mar 16 16:10:11 2012
@@ -265,6 +265,22 @@ class AlterTableConstantAction extends D
 
 	// INTERFACE METHODS
 
+    /**
+     * Run this constant action.
+     *
+     * @param activation the activation in which to run the action
+     * @throws StandardException if an error happens during execution
+     * of the action
+     */
+    public void executeConstantAction(Activation activation)
+            throws StandardException {
+        try {
+            executeConstantActionBody(activation);
+        } finally {
+            clearState();
+        }
+    }
+
 	/**
 	 *	This is the guts of the Execution-time logic for ALTER TABLE.
 	 *
@@ -272,15 +288,14 @@ class AlterTableConstantAction extends D
 	 *
 	 * @exception StandardException		Thrown on failure
 	 */
-	public void	executeConstantAction(
-    Activation activation)
-        throws StandardException
-	{
-		LanguageConnectionContext   lcc = 
-            activation.getLanguageConnectionContext();
-		DataDictionary              dd = lcc.getDataDictionary();
-		DependencyManager           dm = dd.getDependencyManager();
-		TransactionController       tc = lcc.getTransactionExecute();
+    private void executeConstantActionBody(Activation activation)
+            throws StandardException {
+        // Save references to the main structures we need.
+        this.activation = activation;
+        lcc = activation.getLanguageConnectionContext();
+        dd = lcc.getDataDictionary();
+        dm = dd.getDependencyManager();
+        tc = lcc.getTransactionExecute();
 
 		int							numRows = 0;
         boolean						tableScanned = false;
@@ -626,6 +641,23 @@ class AlterTableConstantAction extends D
 		}
 	}
 
+    /**
+     * Clear the state of this constant action.
+     */
+    private void clearState() {
+        // DERBY-3009: executeConstantAction() stores some of its state in
+        // instance variables instead of local variables for convenience.
+        // These variables should be cleared after the execution of the
+        // constant action has completed, so that the objects they reference
+        // can be garbage collected.
+        td = null;
+        lcc = null;
+        dd = null;
+        dm = null;
+        tc = null;
+        activation = null;
+    }
+
 	/**
 	 * Update statistics of either all the indexes on the table or only one
 	 * specific index depending on what user has requested.

Modified: db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java?rev=1301621&r1=1301620&r2=1301621&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java
(original)
+++ db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java
Fri Mar 16 16:10:11 2012
@@ -42,6 +42,7 @@ public class _Suite extends BaseJDBCTest
         suite.addTest(RolesDependencyTest.suite());
         suite.addTest(MemoryLeakFixesTest.suite());
         suite.addTest(XAMemTest.suite());
+        suite.addTest(Derby3009Test.suite());
         return suite;
     }
 }



Mime
View raw message