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 mi...@apache.org on 2007/05/07 16:00:36 UTC

svn commit: r535878 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate: GenericConglomerateController.java GenericScanController.java OpenConglomerateScratchSpace.java

Author: mikem
Date: Mon May  7 07:00:32 2007
New Revision: 535878

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

Rather than allocating a scratch RowPosition for every delete/replace/fetch,
changed to use a single copy of a RowPosition allocated on demand per 
openGenericConglomerateController.  If multiple calls to delete, replace, 
and/or fetch are made in the same open controller only one of these objects
will be allocated.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericScanController.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerateScratchSpace.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java?view=diff&rev=535878&r1=535877&r2=535878
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java Mon May  7 07:00:32 2007
@@ -166,7 +166,8 @@
             }
         }
 
-        RowPosition pos = new RowPosition();
+        RowPosition pos = 
+            open_conglom.getRuntimeMem().get_scratch_row_position();
 
         getRowPositionFromRowLocation(loc, pos);
 
@@ -254,7 +255,8 @@
 
         // Get the record handle out of its wrapper.
 
-        RowPosition pos = new RowPosition();
+        RowPosition pos = 
+            open_conglom.getRuntimeMem().get_scratch_row_position();
 
         getRowPositionFromRowLocation(loc, pos);
 
@@ -351,7 +353,8 @@
 
         // Get the record handle out of its wrapper.
 
-        RowPosition pos = new RowPosition();
+        RowPosition pos = 
+            open_conglom.getRuntimeMem().get_scratch_row_position();
 
         getRowPositionFromRowLocation(loc, pos);
 
@@ -445,7 +448,8 @@
             }
         }
 
-        RowPosition pos = new RowPosition();
+        RowPosition pos = 
+            open_conglom.getRuntimeMem().get_scratch_row_position();
 
         getRowPositionFromRowLocation(loc, pos);
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericScanController.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericScanController.java?view=diff&rev=535878&r1=535877&r2=535878
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericScanController.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericScanController.java Mon May  7 07:00:32 2007
@@ -899,7 +899,7 @@
      */
 	public void init(
     OpenConglomerate                open_conglom,
-	FormatableBitSet				            scanColumnList,
+	FormatableBitSet				scanColumnList,
     DataValueDescriptor[]	        startKeyValue,
     int                             startSearchOperator,
     Qualifier                       qualifier[][],
@@ -909,8 +909,7 @@
     {
         super.init(open_conglom);
 
-        // RESOLVE (mikem) - move this into runtime_mem
-        scan_position = allocateScanPosition();
+        scan_position = open_conglom.getRuntimeMem().get_scratch_row_position();
 
         // remember inputs
         init_scanColumnList         = scanColumnList;
@@ -924,7 +923,7 @@
             scan_position);
         
         reusableRecordIdSequenceNumber = 
-                    open_conglom.getContainer().getReusableRecordIdSequenceNumber();
+            open_conglom.getContainer().getReusableRecordIdSequenceNumber();
     }
 
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerateScratchSpace.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerateScratchSpace.java?view=diff&rev=535878&r1=535877&r2=535878
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerateScratchSpace.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerateScratchSpace.java Mon May  7 07:00:32 2007
@@ -64,20 +64,24 @@
      * conglomerate.  This is a full template, independent of the 
      * FormatableBitSet used for access.
      **/
-    private DataValueDescriptor[] scratch_template;
+    private DataValueDescriptor[]   scratch_template;
 
     /**
      * A Scratch row used for qualifying rows in the 
      * conglomerate.  This is a row which matches the FormatableBitSet of rows
      * being returned.
      **/
-    private DataValueDescriptor[] scratch_row;
+    private DataValueDescriptor[]   scratch_row;
 
     /**
-     * A complete array of format id's for this conglomerate.
+     * A complete array of format id's and collation_ids for this conglomerate.
      **/
-    private int[]    format_ids;
-    private int[]    collation_ids;
+    private int[]                   format_ids;
+    private int[]                   collation_ids;
+
+
+    /* scratch space used by ConglomerateController.delete and replace */
+    private RowPosition             scratch_row_position;
 
     /**************************************************************************
      * Constructors for This class:
@@ -182,6 +186,29 @@
         }
 
         return(scratch_template);
+    }
+
+    /**
+     * Return a scratch RowPosition.
+     * <p>
+     * Used by GenericConglomerateController.delete() and 
+     * GenericConglomerateController.replace().  It may be reused so callers
+     * must insure that object no longer needed before next possible call
+     * to get it again.
+     * <p>
+     *
+	 * @return a scratch RowPosition.
+     *
+	 * @exception  StandardException  Standard exception policy.
+     **/
+    public RowPosition get_scratch_row_position()
+    {
+        if (scratch_row_position == null)
+        {
+            scratch_row_position = new RowPosition();
+        }
+
+        return(scratch_row_position);
     }
 
     /**