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/13 00:43:27 UTC
svn commit: r743931 - in /db/derby/code/branches/10.1/java:
engine/org/apache/derby/impl/store/raw/data/
testing/org/apache/derbyTesting/functionTests/master/
testing/org/apache/derbyTesting/functionTests/suites/
testing/org/apache/derbyTesting/functio...
Author: kmarsden
Date: Thu Feb 12 23:43:26 2009
New Revision: 743931
URL: http://svn.apache.org/viewvc?rev=743931&view=rev
Log:
DERBY-4050 Multithreaded clob update causes growth in table that does not get reclaimed
Added:
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/ClobReclamationTest.out
- copied unchanged from r743798, db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/ClobReclamationTest.out
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClobReclamationTest.java
- copied unchanged from r743798, db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClobReclamationTest.java
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClobReclamationTest_derby.properties
- copied unchanged from r743798, db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClobReclamationTest_derby.properties
Modified:
db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/ReclaimSpaceHelper.java
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall
Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/ReclaimSpaceHelper.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/ReclaimSpaceHelper.java?rev=743931&r1=743930&r2=743931&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/ReclaimSpaceHelper.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/ReclaimSpaceHelper.java Thu Feb 12 23:43:26 2009
@@ -258,9 +258,28 @@
}
if (work.incrAttempts() < 3) // retry this for serveral times
+ {
return Serviceable.REQUEUE;
+ }
else
+ {
+ // If code gets here, the space will be lost forever, and
+ // can only be reclaimed by a full offline compress of the
+ // table/index.
+
+ if (SanityManager.DEBUG)
+ {
+ if (SanityManager.DEBUG_ON(DaemonService.DaemonTrace))
+ {
+ SanityManager.DEBUG(
+ DaemonService.DaemonTrace,
+ " gave up after 3 tries to get container lock " +
+ work);
+ }
+ }
+
return Serviceable.DONE;
+ }
}
// At this point, container is opened with IX lock.
@@ -280,8 +299,8 @@
return Serviceable.DONE;
}
- // We are reclaiming row space or long column. First get an xlock on the
- // head row piece.
+ // We are reclaiming row space or long column.
+ // First get an xlock on the head row piece.
RecordHandle headRecord = work.getHeadRowHandle();
if (!container_rlock.lockRecordForWrite(
@@ -290,9 +309,27 @@
// cannot get the row lock, retry
tran.abort();
if (work.incrAttempts() < 3)
+ {
return Serviceable.REQUEUE;
+ }
else
+ {
+ // If code gets here, the space will be lost forever, and
+ // can only be reclaimed by a full offline compress of the
+ // table/index.
+
+ if (SanityManager.DEBUG)
+ {
+ if (SanityManager.DEBUG_ON(DaemonService.DaemonTrace))
+ {
+ SanityManager.DEBUG(
+ DaemonService.DaemonTrace,
+ " gave up after 3 tries to get row lock " +
+ work);
+ }
+ }
return Serviceable.DONE;
+ }
}
// The exclusive lock on the head row has been gotten.
@@ -331,19 +368,33 @@
// operation.
//
long headPageId = ((PageKey)headRecord.getPageId()).getPageNumber();
+ //DERBY-4050 - we wait for the page so we don't have to retry.
+ // prior to the 4050 fix, we called getPageNoWait and just
+ // retried 3 times. This left unreclaimed space if we were
+ // not successful after three tries.
StoredPage headRowPage =
- (StoredPage)containerHdl.getPageNoWait(headPageId);
-
+ (StoredPage)containerHdl.getPage(headPageId);
if (headRowPage == null)
{
- // Cannot get page no wait, try again later.
+ // It is not clear why headRowPage would be null,
+ // but logging the failure in case it happens.
+ // If code gets here, the space will be lost forever, and
+ // can only be reclaimed by a full offline compress of the
+ // table/index.
+
+ if (SanityManager.DEBUG)
+ {
+ if (SanityManager.DEBUG_ON(DaemonService.DaemonTrace))
+ {
+ SanityManager.DEBUG(
+ DaemonService.DaemonTrace,
+ "gave up because hadRowPage was null" +
+ work);
+ }
+ }
tran.abort();
- if (work.incrAttempts() < 3)
- return Serviceable.REQUEUE;
- else
- return Serviceable.DONE;
+ return Serviceable.DONE;
}
-
try
{
headRowPage.removeOrphanedColumnChain(work, containerHdl);
Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall?rev=743931&r1=743930&r2=743931&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall (original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall Thu Feb 12 23:43:26 2009
@@ -30,3 +30,4 @@
store/TestDurabilityProperty.java
store/OnlineCompressTest.java
store/LogDeviceTest.java
+store/ClobReclamationTest.java