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/03 16:52:39 UTC

svn commit: r1356766 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/db/SlaveDatabase.java

Author: dag
Date: Tue Jul  3 14:52:38 2012
New Revision: 1356766

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

Patch fix-ignored-runtime-exceptions-b

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/db/SlaveDatabase.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/db/SlaveDatabase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/db/SlaveDatabase.java?rev=1356766&r1=1356765&r2=1356766&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/db/SlaveDatabase.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/db/SlaveDatabase.java Tue Jul  3 14:52:38 2012
@@ -37,6 +37,8 @@ import org.apache.derby.jdbc.InternalDri
 
 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
@@ -321,11 +323,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);
+                }
+            } 
         }
     }