db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1398947 - in /db/derby/code/branches/10.8: ./ java/client/org/apache/derby/client/net/ java/engine/org/apache/derby/impl/store/raw/log/ java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ java/testing/org/apache/derb...
Date Tue, 16 Oct 2012 19:38:34 GMT
Author: kahatlen
Date: Tue Oct 16 19:38:33 2012
New Revision: 1398947

URL: http://svn.apache.org/viewvc?rev=1398947&view=rev
Log:
DERBY-5937: File handle is leaked when a Slave replication is shutdown with failover=true

Backported revision 1396606 from 10.9. Also modified the test case to
run without security manager, since some of the functionality
SecurityManagerSetup is missing on the 10.8 branch.

Added:
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.java
      - copied, changed from r1396606, db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.java
Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/client/org/apache/derby/client/net/NetCursor.java   (props
changed)
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationSuite.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/build.xml
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
  Merged /db/derby/code/branches/10.9:r1396606
  Merged /db/derby/code/trunk:r1392847,1394407,1395482

Propchange: db/derby/code/branches/10.8/java/client/org/apache/derby/client/net/NetCursor.java
------------------------------------------------------------------------------
  Merged /db/derby/code/branches/10.9/java/client/org/apache/derby/client/net/NetCursor.java:r1396606

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java?rev=1398947&r1=1398946&r2=1398947&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
(original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
Tue Oct 16 19:38:33 2012
@@ -1182,7 +1182,15 @@ public final class LogToFile implements 
 				}
 
 				if (theLog != null)
+                {
+                    if (logOut != null)
+                    {
+                        // Close the currently open log file, if there is
+                        // one. DERBY-5937.
+                        logOut.close();
+                    }
 					logOut = new LogAccessFile(this, theLog, logBufferSize);
+                }
 				
 				if(logSwitchRequired)
 					switchLogFile();

Copied: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.java
(from r1396606, db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.java)
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.java?p2=db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.java&p1=db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.java&r1=1396606&r2=1398947&rev=1398947&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/Derby5937SlaveShutdownTest.java
Tue Oct 16 19:38:33 2012
@@ -65,12 +65,10 @@ public class Derby5937SlaveShutdownTest 
     public static Test suite() {
         Class klass = Derby5937SlaveShutdownTest.class;
         // The default security policy doesn't allow derby.jar to do
-        // networking, which is needed for replication, so install a custom
-        // policy for this test.
-        return new SecurityManagerSetup(
+        // networking. Disable the security manager for this test.
+        return SecurityManagerSetup.noSecurityManager(
             TestConfiguration.singleUseDatabaseDecorator(
-                TestConfiguration.embeddedSuite(klass), MASTER_DB),
-            klass.getName().replace('.', '/') + ".policy", true);
+                TestConfiguration.embeddedSuite(klass), MASTER_DB));
     }
 
     public void testSlaveFailoverLeak() throws Exception {
@@ -98,9 +96,12 @@ public class Derby5937SlaveShutdownTest 
         // Start the master. This will fail until the slave is up, so do
         // it in a loop until successful or time runs out.
         DataSource startMasterDS = JDBCDataSource.getDataSource();
-        JDBCDataSource.setBeanProperty(startMasterDS, "connectionAttributes",
+        String startMasterAttr =
                 "startMaster=true;slaveHost=" + config.getHostName() +
-                ";slavePort=" + config.getPort());
+                ";slavePort=" + config.getPort();
+        JDBCDataSource.setBeanProperty(
+                startMasterDS, "connectionAttributes", startMasterAttr);
+        println("Starting master with attributes: " + startMasterAttr);
         long giveUp =
             System.currentTimeMillis() + NetworkServerTestSetup.getWaitTime();
         Connection c = null;

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationSuite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationSuite.java?rev=1398947&r1=1398946&r2=1398947&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationSuite.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationSuite.java
Tue Oct 16 19:38:33 2012
@@ -81,8 +81,11 @@ public class ReplicationSuite extends Ba
             suite.addTest(ReplicationRun_Local_3_p6.suite());
 
             suite.addTest(ReplicationRun_Local_Derby4910.suite());
+
         }
 
+        suite.addTest(Derby5937SlaveShutdownTest.suite());
+
 		return suite;
 	}
 }

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/build.xml?rev=1398947&r1=1398946&r2=1398947&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/build.xml
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/build.xml
Tue Oct 16 19:38:33 2012
@@ -58,7 +58,7 @@
 
 <!--             ============ Begin Targets ==============                -->
  
-  <target name="FTOtestsubdir" depends="compilet1"/>
+  <target name="FTOtestsubdir" depends="compilet1,copyfiles"/>
 
   <!-- mkdir / init target may not be necessary, just here for reference... -->
   <target name="init">
@@ -87,6 +87,11 @@
     </javac>
   </target>
 
+  <target name="copyfiles">
+    <copy todir="${out.dir}/${this.dir}">
+      <fileset dir="${derby.testing.src.dir}/${this.dir}" includes="*.policy"/>
+    </copy>
+  </target>
 
 <!--             ============= End Targets ==============                -->
 

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?rev=1398947&r1=1398946&r2=1398947&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
Tue Oct 16 19:38:33 2012
@@ -1046,7 +1046,7 @@ public final class TestConfiguration {
         this.userName = DEFAULT_USER_NAME;
         this.userPassword = DEFAULT_USER_PASSWORD;
         this.connectionAttributes = new Properties();
-        this.hostName = null;
+        this.hostName = DEFAULT_HOSTNAME;
         this.port = basePort;
         this.isVerbose = Boolean.valueOf(
             getSystemProperties().getProperty(KEY_VERBOSE)).
@@ -1928,4 +1928,16 @@ public final class TestConfiguration {
     {
         return getPassword(user, passwordToken);
     }
+
+    public final String getDatabasePath(String physicalDatabaseName)
+    {
+        String dbName = physicalDatabaseName.replace('/', File.separatorChar);
+        String dsh = BaseTestCase.getSystemProperty("derby.system.home");
+        if (dsh == null) {
+            Assert.fail("not implemented");
+        } else {
+            dbName = dsh + File.separator + dbName;
+        }
+        return dbName;
+    }
 }



Mime
View raw message