Search in sources :

Example 6 with StandbyServerSync

use of org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync in project jackrabbit-oak by apache.

the class StandbyStoreService method bootstrapMaster.

private void bootstrapMaster(ComponentContext context, FileStore fileStore) {
    Dictionary<?, ?> props = context.getProperties();
    int port = PropertiesUtil.toInteger(props.get(PORT), PORT_DEFAULT);
    String[] ranges = PropertiesUtil.toStringArray(props.get(ALLOWED_CLIENT_IP_RANGES), ALLOWED_CLIENT_IP_RANGES_DEFAULT);
    boolean secure = PropertiesUtil.toBoolean(props.get(SECURE), SECURE_DEFAULT);
    StandbyServerSync standbyServerSync = new StandbyServerSync(port, fileStore, BLOB_CHUNK_SIZE, ranges, secure);
    closer.register(standbyServerSync);
    standbyServerSync.start();
    log.info("Started primary on port {} with allowed IP ranges {}", port, ranges);
}
Also used : StandbyServerSync(org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync)

Example 7 with StandbyServerSync

use of org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync in project jackrabbit-oak by apache.

the class BrokenNetworkIT method useProxy.

private void useProxy(boolean ssl, int skipPosition, int skipBytes, int flipPosition, boolean intermediateChange) throws Exception {
    FileStore serverStore = serverFileStore.fileStore();
    FileStore clientStore = clientFileStore1.fileStore();
    NodeStore store = SegmentNodeStoreBuilders.builder(serverStore).build();
    addTestContent(store, "server");
    serverStore.flush();
    try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), serverStore, MB, ssl)) {
        serverSync.start();
        File spoolFolder = folder.newFolder();
        try (NetworkErrorProxy ignored = new NetworkErrorProxy(proxyPort.getPort(), getServerHost(), serverPort.getPort(), flipPosition, skipPosition, skipBytes);
            StandbyClientSync clientSync = new StandbyClientSync(getServerHost(), proxyPort.getPort(), clientStore, ssl, getClientTimeout(), false, spoolFolder)) {
            clientSync.run();
        }
        assertFalse("stores are equal", serverStore.getHead().equals(clientStore.getHead()));
        if (intermediateChange) {
            addTestContent(store, "server2");
            serverStore.flush();
        }
        try (StandbyClientSync clientSync = new StandbyClientSync(getServerHost(), serverPort.getPort(), clientStore, ssl, getClientTimeout(), false, spoolFolder)) {
            clientSync.run();
        }
    }
    assertEquals("stores are not equal", serverStore.getHead(), clientStore.getHead());
}
Also used : TemporaryFileStore(org.apache.jackrabbit.oak.segment.test.TemporaryFileStore) FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) StandbyServerSync(org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync) StandbyClientSync(org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync) File(java.io.File) NetworkErrorProxy(org.apache.jackrabbit.oak.segment.test.proxy.NetworkErrorProxy)

Example 8 with StandbyServerSync

use of org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync in project jackrabbit-oak by apache.

the class BrokenNetworkIT method testProxy.

@Test
public void testProxy() throws Exception {
    FileStore serverStore = serverFileStore.fileStore();
    FileStore clientStore = clientFileStore1.fileStore();
    NodeStore store = SegmentNodeStoreBuilders.builder(serverStore).build();
    addTestContent(store, "server");
    serverStore.flush();
    try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), serverStore, MB, false);
        StandbyClientSync clientSync = new StandbyClientSync(getServerHost(), serverPort.getPort(), clientStore, false, getClientTimeout(), false, folder.newFolder())) {
        serverSync.start();
        clientSync.run();
    }
    assertEquals(serverStore.getHead(), clientStore.getHead());
}
Also used : TemporaryFileStore(org.apache.jackrabbit.oak.segment.test.TemporaryFileStore) FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) StandbyServerSync(org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync) StandbyClientSync(org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync) Test(org.junit.Test)

Example 9 with StandbyServerSync

use of org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync in project jackrabbit-oak by apache.

the class BrokenNetworkIT method testProxySSL.

@Test
public void testProxySSL() throws Exception {
    FileStore storeS = serverFileStore.fileStore();
    FileStore storeC = clientFileStore1.fileStore();
    NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
    addTestContent(store, "server");
    storeS.flush();
    try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), storeS, MB, true);
        StandbyClientSync clientSync = new StandbyClientSync(getServerHost(), serverPort.getPort(), storeC, true, getClientTimeout(), false, folder.newFolder())) {
        serverSync.start();
        clientSync.run();
    }
    assertEquals(storeS.getHead(), storeC.getHead());
}
Also used : TemporaryFileStore(org.apache.jackrabbit.oak.segment.test.TemporaryFileStore) FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) StandbyServerSync(org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync) StandbyClientSync(org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync) Test(org.junit.Test)

Example 10 with StandbyServerSync

use of org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync in project jackrabbit-oak by apache.

the class FailoverIPRangeIT method createTestWithConfig.

private void createTestWithConfig(String host, String[] ipRanges, boolean expectedToWork) throws Exception {
    FileStore storeS = serverFileStore.fileStore();
    FileStore storeC = clientFileStore.fileStore();
    NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
    try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), storeS, MB, ipRanges);
        StandbyClientSync clientSync = new StandbyClientSync(host, serverPort.getPort(), storeC, false, getClientTimeout(), false, folder.newFolder())) {
        serverSync.start();
        addTestContent(store, "server");
        // this speeds up the test a little bit...
        storeS.flush();
        clientSync.run();
        if (expectedToWork) {
            assertEquals(storeS.getHead(), storeC.getHead());
        } else {
            assertFalse("stores are equal but shouldn't!", storeS.getHead().equals(storeC.getHead()));
        }
    }
}
Also used : TemporaryFileStore(org.apache.jackrabbit.oak.segment.test.TemporaryFileStore) FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) StandbyServerSync(org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync) StandbyClientSync(org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync)

Aggregations

StandbyServerSync (org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync)23 StandbyClientSync (org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync)21 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)18 Test (org.junit.Test)16 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)15 TemporaryFileStore (org.apache.jackrabbit.oak.segment.test.TemporaryFileStore)12 Blob (org.apache.jackrabbit.oak.api.Blob)6 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)6 ByteArrayInputStream (java.io.ByteArrayInputStream)4 File (java.io.File)4 InputStream (java.io.InputStream)4 MBeanServer (javax.management.MBeanServer)4 ObjectName (javax.management.ObjectName)4 NetworkErrorProxy (org.apache.jackrabbit.oak.segment.test.proxy.NetworkErrorProxy)2 Stopwatch (com.google.common.base.Stopwatch)1 ServerSocket (java.net.ServerSocket)1 SegmentGCOptions (org.apache.jackrabbit.oak.segment.compaction.SegmentGCOptions)1 FileStoreBuilder (org.apache.jackrabbit.oak.segment.file.FileStoreBuilder)1 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)1 Ignore (org.junit.Ignore)1