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 2012/07/04 19:29:54 UTC

svn commit: r1357343 - in /db/derby/code/branches/10.8: ./ java/engine/org/apache/derby/impl/db/SlaveDatabase.java

Author: dag
Date: Wed Jul  4 17:29:53 2012
New Revision: 1357343

URL: http://svn.apache.org/viewvc?rev=1357343&view=rev
Log:
DERBY-4269 Failover did not succeed in 2 min.: testReplication_Local_3_p6_autocommit_OK

Backported from trunk as:

svn merge -c 1356766 https://svn.apache.org/repos/asf/db/derby/code/trunk

Patch fix-ignored-runtime-exceptions-b. 


Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/db/SlaveDatabase.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1356766

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/db/SlaveDatabase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/db/SlaveDatabase.java?rev=1357343&r1=1357342&r2=1357343&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/db/SlaveDatabase.java (original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/db/SlaveDatabase.java Wed Jul  4 17:29:53 2012
@@ -38,6 +38,8 @@ import java.sql.Driver;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 import java.util.Properties;
+import org.apache.derby.iapi.reference.MessageId;
+import org.apache.derby.impl.store.replication.ReplicationLogger;
 
 /**
  * SlaveDatabase is an instance of Database, and is booted instead of
@@ -322,11 +324,22 @@ public class SlaveDatabase extends Basic
                         resetCurrentContextManager(bootThreadCm);
                     bootThreadCm = null;
                 }
-            } catch (StandardException se) {
-                // We get here when SlaveController#stopSlave has been
-                // called, or if a fatal exception has been thrown.
-                handleShutdown(se);
-            }
+            } catch (Exception e) {
+                // We get here when SlaveController#stopSlave has been called,
+                // a fatal Derby exception has been thrown, or if a run-time
+                // error is thrown.  Log the error unconditionally to make sure
+                // it can be observed, since if this happens during or after
+                // recovery on a failover, there will be no connection attempt
+                // failing with the error. New connection attempts will just
+                // hang...
+
+                ReplicationLogger rl = new ReplicationLogger(dbname);
+                rl.logError(MessageId.REPLICATION_FATAL_ERROR, e);
+                
+                if (e instanceof StandardException) {
+                    handleShutdown((StandardException)e);
+                }
+            } 
         }
     }