opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -760,7 +760,17 @@ shutdownECL(); this.changelogDB.shutdownDB(); try { this.changelogDB.shutdownDB(); } catch (ChangelogException ignored) { if (debugEnabled()) { TRACER.debugCaught(DebugLogLevel.WARNING, ignored); } } // Remove this instance from the global instance list allInstances.remove(this); @@ -1106,14 +1116,6 @@ } /** * Removes the changelog database directory. */ public void removeDb() { this.changelogDB.removeDB(); } /** * {@inheritDoc} */ @Override opends/src/server/org/opends/server/replication/server/changelog/api/ChangelogDB.java
@@ -80,13 +80,19 @@ /** * Shutdown the replication database. * * @throws ChangelogException * If a database problem happened */ void shutdownDB(); void shutdownDB() throws ChangelogException; /** * Removes the changelog database directory. * * @throws ChangelogException * If a database problem happened */ void removeDB(); void removeDB() throws ChangelogException; /** * Returns the {@link ChangeNumberIndexDB} object. opends/src/server/org/opends/server/replication/server/changelog/je/JEChangelogDB.java
@@ -264,45 +264,60 @@ } } private void shutdownCNIndexDB() private void shutdownCNIndexDB() throws ChangelogException { synchronized (cnIndexDBLock) { if (cnIndexDB != null) { try { cnIndexDB.shutdown(); } catch (ChangelogException ignored) { if (debugEnabled()) { TRACER.debugCaught(DebugLogLevel.WARNING, ignored); } } cnIndexDB.shutdown(); } } } /** {@inheritDoc} */ @Override public void shutdownDB() public void shutdownDB() throws ChangelogException { shutdownCNIndexDB(); // Remember the first exception because : // - we want to try to remove everything we want to remove // - then throw the first encountered exception ChangelogException firstException = null; try { shutdownCNIndexDB(); } catch (ChangelogException e) { firstException = e; } if (dbEnv != null) { dbEnv.shutdown(); } if (firstException != null) { throw firstException; } } /** * Clears all content from the changelog database, but leaves its directory on * the filesystem. * * @throws ChangelogException * If a database problem happened */ public void clearDB() public void clearDB() throws ChangelogException { // Remember the first exception because : // - we want to try to remove everything we want to remove // - then throw the first encountered exception ChangelogException firstException = null; for (DN baseDN : this.sourceDbHandlers.keySet()) { removeDomain(baseDN); @@ -316,26 +331,40 @@ { cnIndexDB.clear(); } catch (Exception ignored) catch (ChangelogException e) { if (debugEnabled()) firstException = e; } try { shutdownCNIndexDB(); } catch (ChangelogException e) { if (firstException == null) { TRACER.debugCaught(DebugLogLevel.WARNING, ignored); firstException = e; } } shutdownCNIndexDB(); cnIndexDB = null; } } if (firstException != null) { throw firstException; } } /** {@inheritDoc} */ @Override public void removeDB() public void removeDB() throws ChangelogException { StaticUtils.recursiveDelete(dbDirectory); // there is no point in keeping the DB open after it has been removed shutdownDB(); } /** {@inheritDoc} */ opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java
@@ -1443,7 +1443,7 @@ * Disconnect broker and remove entries from the local DB * @param testCase The name of the test case. */ private void afterTest(String testCase) private void afterTest(String testCase) throws Exception { // Check that the domain has completed the import/export task. if (replDomain != null) opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
@@ -464,7 +464,7 @@ assertEquals(DirectoryServer.getBackend("replicationChanges"), null, "Replication changes backend object has been left"); } protected void clearChangelogDB(ReplicationServer rs) protected void clearChangelogDB(ReplicationServer rs) throws Exception { ((JEChangelogDB) rs.getChangelogDB()).clearDB(); } @@ -473,8 +473,10 @@ * Cleanup databases of the currently instantiated replication servers in the * VM */ protected void cleanUpReplicationServersDB() { for (ReplicationServer rs : ReplicationServer.getAllInstances()) { protected void cleanUpReplicationServersDB() throws Exception { for (ReplicationServer rs : ReplicationServer.getAllInstances()) { clearChangelogDB(rs); } } @@ -483,21 +485,23 @@ * Remove trailing directories and databases of the currently instantiated * replication servers. */ protected void removeReplicationServerDB() { for (ReplicationServer rs : ReplicationServer.getAllInstances()) { protected void removeReplicationServerDB() throws Exception { for (ReplicationServer rs : ReplicationServer.getAllInstances()) { clearChangelogDB(rs); rs.removeDb(); rs.getChangelogDB().removeDB(); } } protected void remove(ReplicationServer... replicationServers) protected void remove(ReplicationServer... replicationServers) throws Exception { for (ReplicationServer rs : replicationServers) { if (rs != null) { rs.remove(); rs.removeDb(); rs.getChangelogDB().removeDB(); } } } opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/FractionalReplicationTest.java
@@ -401,7 +401,7 @@ gen = new CSNGenerator(DS2_ID, 0L); } private void endTest() private void endTest() throws Exception { if (replicationDomain != null) { opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ReplicationServerLoadBalancingTest.java
@@ -766,7 +766,7 @@ } } private void stopRs(int... rsIndexes) private void stopRs(int... rsIndexes) throws Exception { for (int rsIndex : rsIndexes) { opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/AssuredReplicationServerTest.java
@@ -201,7 +201,7 @@ rs1 = rs2 = rs3 = rs4 = null; } private void endTest() private void endTest() throws Exception { disableService(fakeRDs); Arrays.fill(fakeRDs, null); opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java
@@ -2069,7 +2069,7 @@ } @AfterMethod public void clearReplicationDb() public void clearReplicationDb() throws Exception { clearChangelogDB(replicationServer); }