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 da...@apache.org on 2011/04/18 22:21:08 UTC

svn commit: r1094730 - in /db/derby/code/branches/10.8: ./ java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java

Author: dag
Date: Mon Apr 18 20:21:07 2011
New Revision: 1094730

URL: http://svn.apache.org/viewvc?rev=1094730&view=rev
Log:
DERBY-5185 store/rollForwardRecovery.sql stuck in RAFContainer4.recoverContainerAfterInterrupt() during shutdown

Backported from trunk (svn revision 1094728).

Follow-up patch derby-5185-3a which contains safe guard limits to two loops waiting for
a condition variable: wait maximum one minute to avoid infinite hangs.


Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Apr 18 20:21:07 2011
@@ -1,2 +1,2 @@
 /db/derby/code/branches/10.7:1061570,1061578,1082235
-/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572
+/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java?rev=1094730&r1=1094729&r2=1094730&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java (original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java Mon Apr 18 20:21:07 2011
@@ -308,6 +308,8 @@ class RAFContainer4 extends RAFContainer
             synchronized (channelCleanupMonitor) {
 
                 // Gain entry
+                int retries = MAX_INTERRUPT_RETRIES;
+
                 while (restoreChannelInProgress) {
                     if (Thread.currentThread() == threadDoingRestore) {
                         // Reopening the container will do readEmbryonicPage
@@ -317,8 +319,13 @@ class RAFContainer4 extends RAFContainer
                         break;
                     }
 
+                    if (retries-- == 0) {
+                        throw StandardException.newException(
+                            SQLState.FILE_IO_INTERRUPTED);
+                    }
+
                     try {
-                        channelCleanupMonitor.wait();
+                        channelCleanupMonitor.wait(INTERRUPT_RETRY_SLEEP);
                     } catch (InterruptedException e) {
                         InterruptStatus.setInterrupted();
                     }
@@ -527,9 +534,16 @@ class RAFContainer4 extends RAFContainer
             synchronized (channelCleanupMonitor) {
 
                 // Gain entry
+                int retries = MAX_INTERRUPT_RETRIES;
+
                 while (restoreChannelInProgress) {
+                    if (retries-- == 0) {
+                        throw StandardException.newException(
+                            SQLState.FILE_IO_INTERRUPTED);
+                    }
+
                     try {
-                        channelCleanupMonitor.wait();
+                        channelCleanupMonitor.wait(INTERRUPT_RETRY_SLEEP);
                     } catch (InterruptedException e) {
                         InterruptStatus.setInterrupted();
                     }