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 ma...@apache.org on 2010/07/07 17:55:05 UTC
svn commit: r961419 - in /db/derby/code/branches/10.5: ./
java/engine/org/apache/derby/impl/store/access/conglomerate/
java/testing/org/apache/derbyTesting/functionTests/tests/store/
Author: mamta
Date: Wed Jul 7 15:55:05 2010
New Revision: 961419
URL: http://svn.apache.org/viewvc?rev=961419&view=rev
Log:
Merged changes for DERBY-4676 (NullPointerException on SELECT on INNER JOIN) into 10.5 codeline
Added:
db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby4676Test.java
- copied unchanged from r952138, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby4676Test.java
Modified:
db/derby/code/branches/10.5/ (props changed)
db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java
db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerate.java
db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 7 15:55:05 2010
@@ -1,2 +1,2 @@
/db/derby/code/branches/10.6:957000
-/db/derby/code/trunk:757811,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792434,793089,793588,794106,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,829410,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,892912,897161,898635,901165,901648,901760,903108,908418,908586,909176,911315,915733,916075,916897,918359,921028,927430,928065,942286,942476,942480,942587,946794,948045,948069,951346,954748,955001,955634,956075,956445,956659,958163,959550
+/db/derby/code/trunk:757811,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792434,793089,793588,794106,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,829410,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,892912,897161,898635,901165,901648,901760,903108,908418,908586,909176,911315,915733,916075,916897,918359,921028,927430,928065,942286,942476,942480,942587,946794,948045,948069,951346,952138,954748,955001,955634,956075,956445,956659,958163,959550
Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java?rev=961419&r1=961418&r2=961419&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java Wed Jul 7 15:55:05 2010
@@ -284,6 +284,14 @@ public abstract class GenericConglomerat
pos, (RowPosition) null, false, true);
}
+ if (pos.current_page == null)
+ {
+ // The page is not latched after locking the row. This happens if
+ // the row was deleted while we were waiting for the lock. Return
+ // false to indicate that the row is no longer valid. (DERBY-4676)
+ return false;
+ }
+
// Fetch the row.
// RESOLVE (STO061) - don't know whether the fetch is for update or not.
//
@@ -381,6 +389,14 @@ public abstract class GenericConglomerat
pos, (RowPosition) null, false, waitForLock);
}
+ if (pos.current_page == null)
+ {
+ // The page is not latched after locking the row. This happens if
+ // the row was deleted while we were waiting for the lock. Return
+ // false to indicate that the row is no longer valid. (DERBY-4676)
+ return false;
+ }
+
// Fetch the row.
// RESOLVE (STO061) - don't know whether the fetch is for update or not.
//
Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerate.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerate.java?rev=961419&r1=961418&r2=961419&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerate.java (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerate.java Wed Jul 7 15:55:05 2010
@@ -276,11 +276,25 @@ public abstract class OpenConglomerate
}
/**
+ * <p>
* Latch the page containing the current RowPosition.
+ * </p>
+ *
* <p>
* This implementation also automatically updates the RowPosition to
* point at the slot containing the current RowPosition. This slot
* value is only valid while the latch is held.
+ * </p>
+ *
+ * <p>
+ * If the row pointed to by {@code pos} does not exist (including the
+ * case where the page itself does not exist), the page will not be
+ * latched, and {@code pos.current_page} will be set to {@code null}.
+ * </p>
+ *
+ * @param pos the position to a row on the page that should be latched
+ * @return {@code true} if the page was successfully latched, or
+ * {@code false} otherwise
*
* @exception StandardException Standard exception policy.
**/
@@ -329,13 +343,18 @@ public abstract class OpenConglomerate
/**
+ * <p>
* Lock row at given row position for read.
+ * </p>
+ *
* <p>
* This routine requests a row lock NOWAIT on the row located at the given
* RowPosition. If the lock is granted NOWAIT the
* routine will return true. If the lock cannot be granted NOWAIT, then
* the routine will release the latch on "page" and then it will request
* a WAIT lock on the row.
+ * </p>
+ *
* <p>
* This implementation:
* Assumes latch held on current_page.
@@ -344,11 +363,22 @@ public abstract class OpenConglomerate
* If the current_rh field of RowPosition is null, it is assumed the we
* want to lock the indicated current_slot. Upon return current_rh will
* point to the record handle associated with current_slot.
+ * </p>
+ *
* <p>
* After waiting and getting the lock on the row, this routine will fix up
* RowPosition to point at the row locked. This means it will get the
* page latch again, and it will fix the current_slot to point at the
* waited for record handle - it may have moved while waiting on the lock.
+ * </p>
+ *
+ * <p>
+ * When this method returns, the page holding the row pointed to by the
+ * {@code RowLocation} is latched. This is however not the case if
+ * {@code moveForwardIfRowDisappears} is {@code false} and the row has
+ * disappeared. Then the latch will be released before the method returns,
+ * and {@code pos.current_page} will be set to {@code null}.
+ * </p>
*
* @param pos Position to lock.
* @param aux_pos If you have to give up latch to get lock, then also
@@ -356,8 +386,8 @@ public abstract class OpenConglomerate
* @param moveForwardIfRowDisappears
* If true, then this routine must handle the case where
* the row id we are waiting on disappears when the latch
- * is released. If false an exception will be thrown if
- * the row disappears.
+ * is released. If false, and the row disappears, the
+ * latch will be released again and false is returned.
* @param waitForLock
* if true wait for lock, if lock can't be granted NOWAIT,
* else if false, throw a lock timeout exception if the
@@ -470,6 +500,25 @@ public abstract class OpenConglomerate
return(lock_granted_with_latch_held);
}
+ /**
+ * <p>
+ * Lock the row at the given position for write.
+ * </p>
+ *
+ * <p>
+ * The page pointed to by the {@code RowPosition} is assumed to be latched
+ * when this method is called. If the lock cannot be obtained without
+ * waiting, the latch will be released and re-obtained when the lock has
+ * been acquired.
+ * </p>
+ *
+ * <p>
+ * If the latch was released while waiting for the lock, and the row does
+ * not exist after the lock is obtained, the latch will be released again
+ * before the method returns, and {@code pos.current_page} will be set to
+ * {@code null}.
+ * </p>
+ */
public boolean lockPositionForWrite(
RowPosition pos,
boolean forInsert,
Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java?rev=961419&r1=961418&r2=961419&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java Wed Jul 7 15:55:05 2010
@@ -55,6 +55,7 @@ public class _Suite extends BaseTestCase
suite.addTest(ClassLoaderBootTest.suite());
suite.addTest(StreamingColumnTest.suite());
suite.addTest(Derby3625Test.suite());
+ suite.addTest(Derby4676Test.suite());
suite.addTest(BootLockTest.suite());
suite.addTest(PositionedStoreStreamTest.suite());
suite.addTest(OSReadOnlyTest.suite());