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 km...@apache.org on 2009/02/12 21:28:32 UTC
svn commit: r743867 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClobReclamationTest.java
Author: kmarsden
Date: Thu Feb 12 20:28:32 2009
New Revision: 743867
URL: http://svn.apache.org/viewvc?rev=743867&view=rev
Log:
DERBY-4055 Test case to reproduce part of the issue pertaining to not getting the row lock. To reproduce enable ClobReclamationTest.xtestMultiThreadUpdateSingleRow(). This does not fix the issue.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClobReclamationTest.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClobReclamationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClobReclamationTest.java?rev=743867&r1=743866&r2=743867&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClobReclamationTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClobReclamationTest.java Thu Feb 12 20:28:32 2009
@@ -58,10 +58,15 @@
* a long value (>32K) Thread 2 updates row with a short clob ("hello");
* NUMALLOCATEDPAGES should be only 3 after each does 500 updates
*
+ * @param lockTable true if we should get an exclusive lock on the table
+ * before update
+ * @param updateSingleRow true if we should try updating a single row
+ * instead of different rows
+ *
* @throws SQLException
* @throws InterruptedException
*/
- public void testMultiThreadedUpdate(final boolean lockTable) throws SQLException,
+ public void testMultiThreadedUpdate(final boolean lockTable, boolean updateSingleRow) throws SQLException,
InterruptedException {
// need to do a getConnection or we get a
// junit assertion that driver is not registered.
@@ -69,7 +74,7 @@
final String updateString = Formatters.repeatChar("a", 33000);
Thread[] threads = new Thread[NUM_THREADS];
for (int i = 0; i < NUM_THREADS; i++) {
- final int key = i + 1;
+ final int key = updateSingleRow ? 1 : i + 1;
threads[i] = new Thread() {
public void run() {
try {
@@ -122,7 +127,7 @@
* @throws InterruptedException
*/
public void testMultiThreadedUpdateRowLocking() throws SQLException, InterruptedException {
- testMultiThreadedUpdate(false);
+ testMultiThreadedUpdate(false /* don't lock table */, false /*don't update single row*/);
}
/**
@@ -134,7 +139,18 @@
* @throws InterruptedException
*/
public void xtestMultiThreadedUpdateTableLocking() throws SQLException, InterruptedException {
- testMultiThreadedUpdate(true);
+ testMultiThreadedUpdate(true /*lock table */, false /* don't update single row */ );
+ }
+
+ /**
+ * Test multiThreaded update of single row to cause lock contention
+ * This will trigger the row lock retry case of DERBY-4055
+ *
+ * @throws SQLException
+ * @throws InterruptedException
+ */
+ public void xtestMultiThreadUpdateSingleRow() throws SQLException, InterruptedException {
+ testMultiThreadedUpdate(false /*don't lock table */, true /* update single row */ );
}
public static Test suite() {