db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From be...@apache.org
Subject svn commit: r345237 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java
Date Thu, 17 Nov 2005 12:44:45 GMT
Author: bernt
Date: Thu Nov 17 04:44:16 2005
New Revision: 345237

URL: http://svn.apache.org/viewcvs?rev=345237&view=rev
Log:
DERBY-707 providing RowLocation for deleted+purged row to GenericConglomerateController causes
nullpointerexception, submitted by andreas.korneliussen@sun.com

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java?rev=345237&r1=345236&r2=345237&view=diff
==============================================================================
--- 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
Thu Nov 17 04:44:16 2005
@@ -180,7 +180,10 @@
 
         getRowPositionFromRowLocation(loc, pos);
 
-        open_conglom.latchPage(pos);
+        if (!open_conglom.latchPage(pos)) 
+        {
+            return false;
+        }
 
         open_conglom.lockPositionForWrite(pos, false /* not an insert */, true);
 
@@ -362,7 +365,10 @@
 
         getRowPositionFromRowLocation(loc, pos);
 
-        open_conglom.latchPage(pos);
+        if (!open_conglom.latchPage(pos)) 
+        {
+            return false;
+        }
 
         // Do not get U row lock - only get X or S.  There is not good point
         // currently to convert the U lock to an S lock, we don't know when
@@ -453,7 +459,10 @@
 
         getRowPositionFromRowLocation(loc, pos);
 
-        open_conglom.latchPage(pos);
+        if (!open_conglom.latchPage(pos)) 
+        {
+            return false;
+        }
 
         open_conglom.lockPositionForWrite(pos, false, true);
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java?rev=345237&r1=345236&r2=345237&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java
Thu Nov 17 04:44:16 2005
@@ -3750,8 +3750,8 @@
     /**
      * Test critical cases for read uncommitted.
      * <p>
-     * test 1 - test heap fetch of row on page which does not exist.  
-     * test 2 - test heap fetch of row on page where row does not exist.
+     * test 1 - test heap fetch, delete and replace of row on page which does not exist.
 
+     * test 2 - test heap fetch, delete and replace of row on page where row does not exist.
      *
 	 * @exception  StandardException  Standard exception policy.
      **/
@@ -3848,11 +3848,35 @@
                 TransactionController.MODE_RECORD,
                 TransactionController.ISOLATION_READ_UNCOMMITTED);
 
+        // Test heap fetch of row on page which does not exist.
         if (cc.fetch(deleted_page_rowloc, big_row.getRowArray(), null))
         {
             throw T_Fail.testFailMsg(
                 "(readUncommitted) fetch should ret false for reclaimed page.");
         }
+             
+        // Test heap replace of row on page which does not exist.
+        FormatableBitSet   update_desc = new FormatableBitSet(1);
+        if (cc.replace(deleted_page_rowloc, big_row.getRowArray(), update_desc)) 
+        {
+            throw T_Fail.testFailMsg(
+                "(readUncommitted) delete should ret false for reclaimed page.");
+        }
+       
+        // Test heap fetch (overloaded call) of row on page which does not exist.
+        if (cc.fetch(deleted_page_rowloc, big_row.getRowArray(), null, true))
+        {
+            throw T_Fail.testFailMsg(
+                "(readUncommitted) fetch should ret false for reclaimed page.");
+        }
+        
+        // Test heap delete of row on page which does not exist.
+        if (cc.delete(deleted_page_rowloc)) 
+        {
+            throw T_Fail.testFailMsg(
+                "(readUncommitted) delete should ret false for reclaimed page.");
+        }
+                
         cc.close();
 
         /*
@@ -3943,11 +3967,34 @@
         // the following will be attempting to fetch a row which has been
         // reclaimed by post commit, on an existing page.
 
+        // test heap fetch of row on page where row does not exist.
         if (cc.fetch(deleted_row_rowloc, big_row.getRowArray(), null))
         {
             throw T_Fail.testFailMsg(
                 "(readUncommitted) fetch should ret false for reclaimed row.");
         }
+        
+        // test heap replace of row on page where row does not exist.
+        if (cc.replace(deleted_page_rowloc, big_row.getRowArray(), update_desc)) 
+        {
+            throw T_Fail.testFailMsg(
+                "(readUncommitted) delete should ret false for reclaimed page.");
+        }
+
+        // test heap fetch (overloaded) of row on page where row does not exist.
+        if (cc.fetch(deleted_page_rowloc, big_row.getRowArray(), null, true))
+        {
+            throw T_Fail.testFailMsg(
+                "(readUncommitted) fetch should ret false for reclaimed page.");
+        }
+        
+        // test heap delete of row on page where row does not exist.
+        if (cc.delete(deleted_page_rowloc)) 
+        {
+            throw T_Fail.testFailMsg(
+                "(readUncommitted) delete should ret false for reclaimed page.");
+        }
+
         cc.close();
 
         /*



Mime
View raw message