diff --git oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTestIT.java oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTestIT.java index ac5720f..2f0b48d 100644 --- oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTestIT.java +++ oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTestIT.java @@ -85,7 +85,6 @@ public class StandbyTestIT extends TestBase { * OAK-2430 */ @Test - @Ignore("OAK-4707") public void testSyncLoop() throws Exception { final int blobSize = 25 * 1024; final int dataNodes = 5000; diff --git oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/TestBase.java oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/TestBase.java index a0d9616..28c4142 100644 --- oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/TestBase.java +++ oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/TestBase.java @@ -25,12 +25,15 @@ import static org.junit.Assume.assumeTrue; import java.io.File; import java.io.IOException; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.SystemUtils; import org.apache.jackrabbit.oak.commons.CIHelper; import org.apache.jackrabbit.oak.segment.file.FileStore; import org.apache.jackrabbit.oak.segment.standby.client.StandbyClient; +import org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider; import org.junit.BeforeClass; public class TestBase { @@ -47,12 +50,15 @@ public class TestBase { File directoryS; FileStore storeS; + ScheduledExecutorService executorS; File directoryC; FileStore storeC; + ScheduledExecutorService executorC; File directoryC2; FileStore storeC2; + ScheduledExecutorService executorC2; /* Java 6 on Windows doesn't support dual IP stacks, so we will skip our IPv6 @@ -68,14 +74,16 @@ public class TestBase { public void setUpServerAndClient() throws Exception { // server directoryS = createTmpTargetDir(getClass().getSimpleName()+"-Server"); - storeS = setupPrimary(directoryS); + executorS = newExecutor(); + storeS = setupPrimary(executorS, directoryS); // client directoryC = createTmpTargetDir(getClass().getSimpleName()+"-Client"); - storeC = setupSecondary(directoryC); + executorC = newExecutor(); + storeC = setupSecondary(executorC, directoryC); } - private static FileStore newFileStore(File directory) throws Exception { + private static FileStore newFileStore(ScheduledExecutorService executor, File directory) throws Exception { return fileStoreBuilder(directory) .withMaxFileSize(1) .withMemoryMapping(false) @@ -83,19 +91,30 @@ public class TestBase { .withSegmentCacheSize(0) .withStringCacheSize(0) .withTemplateCacheSize(0) + .withStatisticsProvider(new DefaultStatisticsProvider(executor)) .build(); } - protected FileStore setupPrimary(File directory) throws Exception { - return newFileStore(directory); + private FileStore setupPrimary(ScheduledExecutorService executor, File directory) throws Exception { + return newFileStore(executor, directory); } protected FileStore getPrimary() { return storeS; } - protected FileStore setupSecondary(File directory) throws Exception { - return newFileStore(directoryC); + private FileStore setupSecondary(ScheduledExecutorService executor, File directory) throws Exception { + return newFileStore(executor, directoryC); + } + + private ScheduledExecutorService newExecutor() { + return Executors.newSingleThreadScheduledExecutor(); + } + + private void closeExecutor(ScheduledExecutorService executor) { + if (executor != null) { + executor.shutdownNow(); + } } protected FileStore getSecondary() { @@ -106,12 +125,15 @@ public class TestBase { setUpServerAndClient(); directoryC2 = createTmpTargetDir(getClass().getSimpleName()+"-Client2"); - storeC2 = newFileStore(directoryC2); + executorC2 = newExecutor(); + storeC2 = newFileStore(executorC2, directoryC2); } public void closeServerAndClient() { storeS.close(); storeC.close(); + closeExecutor(executorS); + closeExecutor(executorC); try { FileUtils.deleteDirectory(directoryS); FileUtils.deleteDirectory(directoryC); @@ -122,6 +144,7 @@ public class TestBase { public void closeServerAndTwoClients() { closeServerAndClient(); storeC2.close(); + closeExecutor(executorC2); try { FileUtils.deleteDirectory(directoryC2); } catch (IOException e) {