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 ka...@apache.org on 2011/04/11 12:00:27 UTC
svn commit: r1091000 - in /db/derby/code/trunk/java:
engine/org/apache/derby/impl/store/replication/slave/
testing/org/apache/derbyTesting/functionTests/tests/replicationTests/
Author: kahatlen
Date: Mon Apr 11 10:00:27 2011
New Revision: 1091000
URL: http://svn.apache.org/viewvc?rev=1091000&view=rev
Log:
DERBY-4910: Four replication tests fail on z/OS with
junit.framework.AssertionFailedError: startMaster did not succeed.
Changed the error handling in SlaveController to account for the
changes in nesting of exceptions in DERBY-4812.
Added:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_Derby4910.java
- copied, changed from r1090804, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_1.java
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/slave/SlaveController.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationSuite.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/slave/SlaveController.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/slave/SlaveController.java?rev=1091000&r1=1090999&r2=1091000&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/slave/SlaveController.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/replication/slave/SlaveController.java Mon Apr 11 10:00:27 2011
@@ -349,18 +349,13 @@ public class SlaveController
return true; // will not reach this if timeout
} catch (StandardException se) {
throw se;
+ } catch (SocketTimeoutException ste) {
+ // Got a timeout. Return normally and let the caller retry.
+ return false;
} catch (Exception e) {
- // SocketTimeoutException is wrapped in
- // PrivilegedActionException.
- Throwable cause = e.getCause();
- if (cause instanceof SocketTimeoutException) {
- // Timeout!
- return false;
- } else {
- throw StandardException.newException
+ throw StandardException.newException
(SQLState.REPLICATION_CONNECTION_EXCEPTION, e,
dbname, getHostName(), String.valueOf(getPortNumber()));
- }
}
}
Copied: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_Derby4910.java (from r1090804, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_1.java)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_Derby4910.java?p2=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_Derby4910.java&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_1.java&r1=1090804&r2=1091000&rev=1091000&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_1.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun_Local_Derby4910.java Mon Apr 11 10:00:27 2011
@@ -1,6 +1,6 @@
/*
-Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.ReplicationRun_local_1
+Derby - Class org.apache.derbyTesting.functionTests.tests.replicationTests.ReplicationRun_Local_Derby4910
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -26,36 +26,39 @@ import org.apache.derbyTesting.junit.Sec
/**
- * Run a replication test on localhost
- * by using default values for master and slave hosts,
- * and master and slave ports.
- *
+ * Test that the startSlave command doesn't fail if it takes more than a
+ * second before the master attempts to connect to the slave. Regression test
+ * case for DERBY-4910.
*/
-public class ReplicationRun_Local_1 extends ReplicationRun
+public class ReplicationRun_Local_Derby4910 extends ReplicationRun
{
/**
- * Creates a new instance of ReplicationRun_Local
+ * Creates a new instance of this test class.
* @param testcaseName Identifying the test.
*/
- public ReplicationRun_Local_1(String testcaseName)
+ public ReplicationRun_Local_Derby4910(String testcaseName)
{
super(testcaseName);
}
public static Test suite()
{
- TestSuite suite = new TestSuite("ReplicationRun_Local_1 Suite");
+ TestSuite suite = new TestSuite("Replication test - DERBY-4910");
- suite.addTestSuite( ReplicationRun_Local_1.class );
+ suite.addTestSuite( ReplicationRun_Local_Derby4910.class );
return SecurityManagerSetup.noSecurityManager(suite);
}
-
- public void testReplication_Local_1_InsertUpdateDeleteOnMaster()
- throws Exception
+
+ /**
+ * Test that a slave can wait a while for the master to connect without
+ * timing out. The startSlave command used to time out after one second
+ * before DERBY-4910.
+ */
+ public void testSlaveWaitsForMaster() throws Exception
{
cleanAllTestHosts();
@@ -89,6 +92,11 @@ public class ReplicationRun_Local_1 exte
slaveServerHost,
slaveReplPort,
testClientHost);
+
+ // DERBY-4910: The slave used to time out after one second if the
+ // master hadn't connected to it yet. Wait for three seconds before
+ // starting the master to verify that this isn't a problem anymore.
+ Thread.sleep(3000L);
startMaster(jvmVersion, replicatedDb,
masterServerHost, masterServerPort,
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationSuite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationSuite.java?rev=1091000&r1=1090999&r2=1091000&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationSuite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationSuite.java Mon Apr 11 10:00:27 2011
@@ -79,6 +79,8 @@ public class ReplicationSuite extends Ba
suite.addTest(ReplicationRun_Local_Encrypted_1.suite());
suite.addTest(ReplicationRun_Local_3_p6.suite());
+
+ suite.addTest(ReplicationRun_Local_Derby4910.suite());
}
return suite;