db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r522280 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/store/access/ impl/sql/execute/ impl/store/access/ impl/store/access/sort/
Date Sun, 25 Mar 2007 15:24:42 GMT
Author: djd
Date: Sun Mar 25 08:24:41 2007
New Revision: 522280

URL: http://svn.apache.org/viewvc?view=rev&rev=522280
Log:
DERBY-2486 Rename SortController.close to completeInserts which better matches its current
use
and future use once SortController is used to completely control a sort.
Also some minor protection changes of methods in the sort implementation.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/SortController.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DistinctScalarAggregateResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GroupedAggregateResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMTransaction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeInserter.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/SortBuffer.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/SortController.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/SortController.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/SortController.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/SortController.java
Sun Mar 25 08:24:41 2007
@@ -21,11 +21,8 @@
 
 package org.apache.derby.iapi.store.access;
 
-import org.apache.derby.iapi.types.CloneableObject;
-
-import org.apache.derby.iapi.types.DataValueDescriptor;
-
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.types.DataValueDescriptor;
 
 
 /**
@@ -47,23 +44,19 @@
 public interface SortController
 {
 	/**
-	Close this sort controller.
-	<p>
-	Currently, since only one sort controller is allowed per sort,
-	closing the sort controller means the last row has been
-	inserted.
+	Inform SortController that all the rows have
+    been inserted into it. 
 	**/
-	void close();
+	void completedInserts();
 
 	/**
     Insert a row into the sort.
 
-    @param row The row to insert into the conglomerate.  The stored
+    @param row The row to insert into the SortController.  The stored
 	representations of the row's columns are copied into a new row
-	somewhere in the conglomerate.
+	somewhere in the sort.
 
 	@exception StandardException Standard exception policy.
-	@see CloneableObject
     **/
     void insert(DataValueDescriptor[] row)
 		throws StandardException;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
Sun Mar 25 08:24:41 2007
@@ -1531,7 +1531,7 @@
 		boolean updateStatistics = false;
 		if(!truncateTable)
 		{
-			sorters[index].close();
+			sorters[index].completedInserts();
 			sorters[index] = null;
 
 			if (td.statisticsExist(cd))
@@ -1987,11 +1987,10 @@
 	}
 
 	/**
-	 * @see ResultSet#cleanUp
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void	cleanUp() throws StandardException
+	private void	cleanUp() throws StandardException
 	{
 		if (compressHeapCC != null)
 		{
@@ -2011,7 +2010,7 @@
 			{
 				if (sorters[index] != null)
 				{
-					sorters[index].close();
+					sorters[index].completedInserts();
 				}
 				sorters[index] = null;
 			}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
Sun Mar 25 08:24:41 2007
@@ -765,7 +765,7 @@
 		}
 		finally
 		{
-			sorter.close();
+			sorter.completedInserts();
 		}
 
 		return new CardinalityCounter(tc.openSortRowSource(sortId));

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DistinctScalarAggregateResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DistinctScalarAggregateResultSet.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DistinctScalarAggregateResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DistinctScalarAggregateResultSet.java
Sun Mar 25 08:24:41 2007
@@ -382,7 +382,7 @@
 		/*
 		** End the sort and open up the result set
 		*/
-		sorter.close();
+		sorter.completedInserts();
 
 		scanController = 
             tc.openSortScan(sortId, activation.getResultSetHoldability());

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GroupedAggregateResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GroupedAggregateResultSet.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GroupedAggregateResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GroupedAggregateResultSet.java
Sun Mar 25 08:24:41 2007
@@ -270,7 +270,7 @@
 			*/
 			source.close();
 			sortProperties = sorter.getSortInfo().getAllSortInfo(sortProperties);
-			sorter.close();
+			sorter.completedInserts();
 
 			scanController = 
                 tc.openSortScan(sortId, activation.getResultSetHoldability());
@@ -329,7 +329,7 @@
 		}
 		source.close();
 		sortProperties = sorter.getSortInfo().getAllSortInfo(sortProperties);
-		sorter.close();
+		sorter.completedInserts();
 
 		return tc.openSortScan(sortId, activation.getResultSetHoldability());
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
Sun Mar 25 08:24:41 2007
@@ -1805,7 +1805,7 @@
 			// We can finally drain the sorter and rebuild the index
 			// RESOLVE - all indexes are btrees right now
 			// Populate the index.
-			sorters[index].close();
+			sorters[index].completedInserts();
 			sorters[index] = null;
 			rowSources[index] = new CardinalityCounter(tc.openSortRowSource(sortIds[index]));
 			newIndexCongloms[index] = tc.createAndLoadConglomerate(
@@ -1923,7 +1923,7 @@
 			{
 				if (sorters[index] != null)
 				{
-					sorters[index].close();
+					sorters[index].completedInserts();
 				}
 				sorters[index] = null;
 			}
@@ -2213,7 +2213,7 @@
 		for (int index = 0; index < numIndexes; index++)
 		{
 			sorters[index] = tc.openSort(sortIds[index]);
-			sorters[index].close();
+			sorters[index].completedInserts();
 			rowSources[index] = tc.openSortRowSource(sortIds[index]);
 		}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java Sun
Mar 25 08:24:41 2007
@@ -318,7 +318,7 @@
 		}
 		source.close();
 		sortProperties = sorter.getSortInfo().getAllSortInfo(sortProperties);
-		sorter.close();
+		sorter.completedInserts();
 
 		return tc.openSortScan(sortId, activation.getResultSetHoldability());
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMTransaction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMTransaction.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMTransaction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMTransaction.java
Sun Mar 25 08:24:41 2007
@@ -301,7 +301,7 @@
                 for (int i = sortControllers.size() - 1; i >= 0; i--)
                 {
                     SortController sc = (SortController) sortControllers.get(i);
-                    sc.close();
+                    sc.completedInserts();
                 }
                 sortControllers.clear();
             }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeInserter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeInserter.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeInserter.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeInserter.java
Sun Mar 25 08:24:41 2007
@@ -35,28 +35,28 @@
 
 **/
 
-public final class MergeInserter implements SortController
+final class MergeInserter implements SortController
 {
 	/**
 	The sort this inserter is for.
 	**/
-	protected MergeSort sort = null;
+	private MergeSort sort;
 
 	/**
 	The transaction this inserter is in.
 	**/
-	protected TransactionManager tran;
+	private TransactionManager tran;
 
 	/**
 	A vector of the conglomerate ids of the merge runs.
 	**/
-	Vector mergeRuns = null;
+	private Vector mergeRuns;
 
 	/**
 	An in-memory ordered set that is used to sort rows
 	before they're sent to merge runs.
 	**/
-	SortBuffer sortBuffer = null;
+	private SortBuffer sortBuffer;
 
 	/**
 	Information about memory usage to dynamically tune the
@@ -195,15 +195,13 @@
 	}
 
 	/**
-	Close this sort controller.	Closing the sort controller
-	means the caller is done inserting rows.  This method
-	must not throw any exceptions since it's called during
-	error processing.
+     * Called when the caller has completed
+     * inserting rows into the sorter.
 
-	@see SortController#close
+	@see SortController#completedInserts
 	**/
 
-	public void close()
+	public void completedInserts()
 	{
 		// Tell the sort that we're closed, and hand off
 		// the sort buffer and the vector of merge runs.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java
Sun Mar 25 08:24:41 2007
@@ -58,7 +58,7 @@
 
 **/
 
-public final class MergeSort implements Sort
+final class MergeSort implements Sort
 {
 
 	/*
@@ -346,7 +346,7 @@
 		// which will give us any in-progress merge
 		// runs, if there are any.
 		if (inserter != null)
-			inserter.close();
+			inserter.completedInserts();
 		inserter = null;
 
 		// Make sure the scan is closed, if there is one.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/SortBuffer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/SortBuffer.java?view=diff&rev=522280&r1=522279&r2=522280
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/SortBuffer.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/SortBuffer.java
Sun Mar 25 08:24:41 2007
@@ -112,7 +112,7 @@
 	Arrange that the next node allocated in the tree have
 	it's aux field set to the argument.
 	**/
-	public void setNextAux(int aux)
+	void setNextAux(int aux)
 	{
 		nextAux = aux;
 	}
@@ -121,7 +121,7 @@
 	Retrieve the aux value from the last node deallocated
 	from the tree.
 	**/
-	public int getLastAux()
+	int getLastAux()
 	{
 		return lastAux;
 	}
@@ -130,7 +130,7 @@
 	Construct doesn't do anything, callers must call init
 	and check its return code.
 	**/
-	public SortBuffer(MergeSort sort)
+	SortBuffer(MergeSort sort)
 	{
 		this.sort = sort;
 	}
@@ -139,7 +139,7 @@
 	Initialize.  Returns false if the allocator
 	couldn't be initialized.
 	**/
-	public boolean init()
+	boolean init()
 	{
 		allocator = new NodeAllocator();
 
@@ -159,14 +159,14 @@
 		return true;
 	}
 
-	public void reset()
+	void reset()
 	{
 		allocator.reset();
 		head = allocator.newNode();
 		height = 0;
 	}
 
-	public void close()
+	void close()
 	{
 		if (allocator != null)
 			allocator.close();
@@ -178,7 +178,7 @@
 	/**
 	Grow by a certain percent if we can
 	*/
-	public void grow(int percent)
+	void grow(int percent)
 	{
 		if (percent > 0)
 			allocator.grow(percent);
@@ -190,7 +190,7 @@
 	It's the capacity of the node allocator minus one
 	because the sorter uses one node for the head.
 	**/
-	public int capacity()
+	int capacity()
 	{
 		if (allocator == null)
 			return 0;
@@ -204,7 +204,7 @@
 	<P>
 	See Knuth Vol. 3, Sec. 6.2.3, pp. 455-457 for the algorithm.
 	**/
-	public int insert(DataValueDescriptor[] k)
+	int insert(DataValueDescriptor[] k)
 		throws StandardException
 	{
 		int c;
@@ -415,7 +415,7 @@
 	Return the lowest key and delete it from 
 	the tree, preserving the balance of the tree.
 	**/
-	public DataValueDescriptor[] removeFirst()
+	DataValueDescriptor[] removeFirst()
 	{
 		if (head.rightLink == null)
 			return null;



Mime
View raw message