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 rh...@apache.org on 2013/04/24 23:59:55 UTC

svn commit: r1471715 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/

Author: rhillegas
Date: Wed Apr 24 21:59:51 2013
New Revision: 1471715

URL: http://svn.apache.org/r1471715
Log:
DERBY-6201: Fix mutability issues in plan statistics package.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealDeleteCascadeResultSetStatistics.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashScanStatistics.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashTableStatistics.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealProjectRestrictStatistics.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RunTimeStatisticsImpl.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealDeleteCascadeResultSetStatistics.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealDeleteCascadeResultSetStatistics.java?rev=1471715&r1=1471714&r2=1471715&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealDeleteCascadeResultSetStatistics.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealDeleteCascadeResultSetStatistics.java Wed Apr 24 21:59:51 2013
@@ -22,6 +22,7 @@
 package org.apache.derby.impl.sql.execute.rts;
 
 import org.apache.derby.iapi.sql.execute.ResultSetStatistics;
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.i18n.MessageService;
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.sql.execute.xplain.XPLAINVisitor;
@@ -36,8 +37,7 @@ public class RealDeleteCascadeResultSetS
 	extends RealDeleteResultSetStatistics
 {
 
-	/* Leave these fields public for object inspectors */
-	public 	ResultSetStatistics[] 	dependentTrackingArray;
+	private 	ResultSetStatistics[] 	dependentTrackingArray;
 
 	// CONSTRUCTORS
 
@@ -56,7 +56,7 @@ public class RealDeleteCascadeResultSetS
 								)
 	{
 		super(rowCount, deferred, indexesUpdated, tableLock, executeTime, sourceResultSetStatistics);
-		this.dependentTrackingArray = dependentTrackingArray;
+		this.dependentTrackingArray = (ResultSetStatistics[]) ArrayUtil.copy( dependentTrackingArray );
 	}
 
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashScanStatistics.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashScanStatistics.java?rev=1471715&r1=1471714&r2=1471715&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashScanStatistics.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashScanStatistics.java Wed Apr 24 21:59:51 2013
@@ -21,6 +21,7 @@
 
 package org.apache.derby.impl.sql.execute.rts;
 
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.util.PropertyUtil;
 import org.apache.derby.iapi.util.StringUtil;
@@ -116,7 +117,7 @@ public class RealHashScanStatistics
 		this.indexName = indexName;
 		this.isConstraint = isConstraint;
 		this.hashtableSize = hashtableSize;
-		this.hashKeyColumns = hashKeyColumns;
+		this.hashKeyColumns = ArrayUtil.copy( hashKeyColumns );
 		this.scanQualifiers = scanQualifiers;
 		this.nextQualifiers = nextQualifiers;
 		this.scanProperties = new FormatableProperties();

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashTableStatistics.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashTableStatistics.java?rev=1471715&r1=1471714&r2=1471715&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashTableStatistics.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealHashTableStatistics.java Wed Apr 24 21:59:51 2013
@@ -22,6 +22,7 @@
 package org.apache.derby.impl.sql.execute.rts;
 
 import org.apache.derby.iapi.sql.execute.ResultSetStatistics;
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 
 import org.apache.derby.iapi.services.i18n.MessageService;
@@ -98,7 +99,7 @@ public class RealHashTableStatistics
 			optimizerEstimatedCost
 			);
 		this.hashtableSize = hashtableSize;
-		this.hashKeyColumns = hashKeyColumns;
+		this.hashKeyColumns = ArrayUtil.copy( hashKeyColumns );
 		this.nextQualifiers = nextQualifiers;
 		this.scanProperties = new FormatableProperties();
 		if (scanProperties != null)
@@ -109,7 +110,7 @@ public class RealHashTableStatistics
 				this.scanProperties.put(key, scanProperties.get(key));
 			}
 		}
-		this.subqueryTrackingArray = subqueryTrackingArray;
+		this.subqueryTrackingArray = (ResultSetStatistics[]) ArrayUtil.copy( subqueryTrackingArray );
 		this.childResultSetStatistics = childResultSetStatistics;
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealProjectRestrictStatistics.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealProjectRestrictStatistics.java?rev=1471715&r1=1471714&r2=1471715&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealProjectRestrictStatistics.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RealProjectRestrictStatistics.java Wed Apr 24 21:59:51 2013
@@ -26,6 +26,7 @@ import org.apache.derby.catalog.UUID;
 import org.apache.derby.impl.sql.catalog.XPLAINResultSetTimingsDescriptor;
 import org.apache.derby.impl.sql.execute.xplain.XPLAINUtil;
 
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 
 import org.apache.derby.iapi.services.i18n.MessageService;
@@ -96,7 +97,7 @@ public class RealProjectRestrictStatisti
 		this.doesProjection = doesProjection;
 		this.restrictionTime = restrictionTime;
 		this.projectionTime = projectionTime;
-		this.subqueryTrackingArray = subqueryTrackingArray;
+		this.subqueryTrackingArray = (ResultSetStatistics[]) ArrayUtil.copy( subqueryTrackingArray );
 		this.childResultSetStatistics = childResultSetStatistics;
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RunTimeStatisticsImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RunTimeStatisticsImpl.java?rev=1471715&r1=1471714&r2=1471715&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RunTimeStatisticsImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/rts/RunTimeStatisticsImpl.java Wed Apr 24 21:59:51 2013
@@ -22,6 +22,7 @@
 package org.apache.derby.impl.sql.execute.rts;
 
 import org.apache.derby.iapi.sql.execute.ResultSetStatistics;
+import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.io.Formatable;
 
@@ -97,11 +98,15 @@ public final class RunTimeStatisticsImpl
 		this.optimizeTime = optimizeTime;
 		this.generateTime = generateTime;
 		this.executeTime = executeTime;
-		this.beginCompilationTimestamp = beginCompilationTimestamp;
-		this.endCompilationTimestamp = endCompilationTimestamp;
-		this.beginExecutionTimestamp = beginExecutionTimestamp;
-		this.endExecutionTimestamp = endExecutionTimestamp;
-		this.subqueryTrackingArray = subqueryTrackingArray;
+		this.beginCompilationTimestamp =beginCompilationTimestamp == null ?
+            null : (Timestamp) beginCompilationTimestamp.clone();
+		this.endCompilationTimestamp = endCompilationTimestamp == null ?
+            null : (Timestamp) endCompilationTimestamp.clone();
+		this.beginExecutionTimestamp = beginExecutionTimestamp == null ?
+            null : (Timestamp) beginExecutionTimestamp.clone();
+		this.endExecutionTimestamp = endExecutionTimestamp == null ?
+            null : (Timestamp) endExecutionTimestamp.clone();
+		this.subqueryTrackingArray = (ResultSetStatistics[]) ArrayUtil.copy( subqueryTrackingArray );
 		this.topResultSetStatistics = topResultSetStatistics;
 	}
 
@@ -174,7 +179,7 @@ public final class RunTimeStatisticsImpl
 	 */
 	public Timestamp getBeginCompilationTimestamp()
 	{
-		return beginCompilationTimestamp;
+		return beginCompilationTimestamp == null ?  null : (Timestamp) beginCompilationTimestamp.clone();
 	}
 
 	/**
@@ -184,7 +189,7 @@ public final class RunTimeStatisticsImpl
 	 */
 	public Timestamp getEndCompilationTimestamp()
 	{
-		return endCompilationTimestamp;
+		return endCompilationTimestamp == null ? null : (Timestamp) endCompilationTimestamp.clone();
 	}
 
 	/**
@@ -194,7 +199,7 @@ public final class RunTimeStatisticsImpl
 	 */
 	public Timestamp getBeginExecutionTimestamp()
 	{
-		return beginExecutionTimestamp;
+		return beginExecutionTimestamp == null ? null : (Timestamp) beginExecutionTimestamp.clone();
 	}
 
 	/**
@@ -204,7 +209,7 @@ public final class RunTimeStatisticsImpl
 	 */
 	public Timestamp getEndExecutionTimestamp()
 	{
-		return endExecutionTimestamp;
+		return endExecutionTimestamp == null ? null : (Timestamp) endExecutionTimestamp.clone();
 	}
 
 	/**