Search in sources :

Example 21 with FileStore

use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.

the class ExternalPrivateStoreIT method testSyncFailingDueToTooShortTimeout.

@Test
// FIXME OAK-7027
@Ignore("OAK-7027")
public void testSyncFailingDueToTooShortTimeout() throws Exception {
    final int blobSize = 5 * MB;
    FileStore primary = getPrimary();
    FileStore secondary = getSecondary();
    NodeStore store = SegmentNodeStoreBuilders.builder(primary).build();
    addTestContent(store, "server", blobSize);
    try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), primary, MB);
        StandbyClientSync cl = new StandbyClientSync(getServerHost(), 60, secondary, false, getClientTimeout(), false, folder.newFolder())) {
        serverSync.start();
        primary.flush();
        cl.run();
        assertNotEquals(primary.getHead(), secondary.getHead());
        assertEquals(1, cl.getFailedRequests());
    }
}
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) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 22 with FileStore

use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.

the class IOTracerTest method setup.

@Before
public void setup() throws IOException, InvalidFileStoreVersionException {
    try (FileStore fileStore = fileStoreBuilder(folder.getRoot()).build()) {
        SegmentNodeState currentHead = fileStore.getHead();
        SegmentNodeBuilder root = currentHead.builder();
        root.setChildNode("1a");
        root.setChildNode("1b");
        NodeBuilder builder = root.setChildNode("1c");
        builder.setChildNode("2d");
        builder.setChildNode("2e");
        builder = builder.setChildNode("2f");
        builder.setChildNode("3g");
        builder.setChildNode("3h");
        builder.setChildNode("3i").setChildNode("4j");
        SegmentNodeState newHead = root.getNodeState();
        fileStore.getRevisions().setHead(currentHead.getRecordId(), newHead.getRecordId());
    }
}
Also used : FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) SegmentNodeBuilder(org.apache.jackrabbit.oak.segment.SegmentNodeBuilder) SegmentNodeState(org.apache.jackrabbit.oak.segment.SegmentNodeState) SegmentNodeBuilder(org.apache.jackrabbit.oak.segment.SegmentNodeBuilder) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Before(org.junit.Before)

Example 23 with FileStore

use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.

the class DefaultStandbyReferenceReaderTest method shouldReturnEmptyReferences.

@Test
public void shouldReturnEmptyReferences() throws Exception {
    try (FileStore store = newFileStore()) {
        SegmentWriter writer = defaultSegmentWriterBuilder("test").build(store);
        RecordId id = writer.writeNode(EmptyNodeState.EMPTY_NODE);
        writer.flush();
        DefaultStandbyReferencesReader reader = new DefaultStandbyReferencesReader(store);
        Iterable<String> references = reader.readReferences(id.getSegmentId().asUUID().toString());
        assertFalse(references.iterator().hasNext());
    }
}
Also used : FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) RecordId(org.apache.jackrabbit.oak.segment.RecordId) SegmentWriter(org.apache.jackrabbit.oak.segment.SegmentWriter) Test(org.junit.Test)

Example 24 with FileStore

use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.

the class IOTracerRunner method collectDepthFirstTrace.

public void collectDepthFirstTrace(@Nonnull String segmentStore, boolean mmap, int segmentCacheSize, @Nonnull String path, int depth, @Nonnull String output) throws IOException, InvalidFileStoreVersionException {
    checkNotNull(segmentStore);
    checkNotNull(path);
    checkNotNull(output);
    try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(output, true)))) {
        Function<IOMonitor, FileStore> factory = ioMonitor -> newFileStore(fileStoreBuilder(new File(segmentStore)).withMemoryMapping(mmap).withSegmentCacheSize(segmentCacheSize).withIOMonitor(ioMonitor));
        IOTracer ioTracer = newIOTracer(factory, out, DepthFirstTrace.CONTEXT_SPEC);
        ioTracer.collectTrace(new DepthFirstTrace(depth, path, ioTracer::setContext));
    }
}
Also used : PrintWriter(java.io.PrintWriter) InvalidFileStoreVersionException(org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException) IOMonitor(org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitor) IOMonitorAdapter(org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter) BufferedWriter(java.io.BufferedWriter) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) FileWriter(java.io.FileWriter) FileStoreBuilder(org.apache.jackrabbit.oak.segment.file.FileStoreBuilder) IOException(java.io.IOException) Test(org.junit.Test) FileStoreBuilder.fileStoreBuilder(org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder) Function(java.util.function.Function) String.format(java.lang.String.format) File(java.io.File) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) Boolean.parseBoolean(java.lang.Boolean.parseBoolean) IOTracer.newIOTracer(org.apache.jackrabbit.oak.segment.tool.iotrace.IOTracer.newIOTracer) FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) System.getProperty(java.lang.System.getProperty) Integer.getInteger(java.lang.Integer.getInteger) Assume.assumeTrue(org.junit.Assume.assumeTrue) Nonnull(javax.annotation.Nonnull) Before(org.junit.Before) FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) FileWriter(java.io.FileWriter) IOMonitor(org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitor) File(java.io.File) IOTracer.newIOTracer(org.apache.jackrabbit.oak.segment.tool.iotrace.IOTracer.newIOTracer) PrintWriter(java.io.PrintWriter) BufferedWriter(java.io.BufferedWriter)

Example 25 with FileStore

use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.

the class FailoverSslTestIT method testFailoverSecureServerPlainClient.

@Test
public void testFailoverSecureServerPlainClient() throws Exception {
    FileStore storeS = serverFileStore.fileStore();
    FileStore storeC = clientFileStore.fileStore();
    try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), storeS, MB, true);
        StandbyClientSync clientSync = new StandbyClientSync(getServerHost(), serverPort.getPort(), storeC, false, getClientTimeout(), false, folder.newFolder())) {
        assertFalse(synchronizeAndCompareHead(serverSync, clientSync));
    }
}
Also used : TemporaryFileStore(org.apache.jackrabbit.oak.segment.test.TemporaryFileStore) FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) StandbyServerSync(org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync) StandbyClientSync(org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync) Test(org.junit.Test)

Aggregations

FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)106 Test (org.junit.Test)70 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)41 File (java.io.File)25 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)25 StandbyClientSync (org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync)18 StandbyServerSync (org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync)18 IOException (java.io.IOException)17 SegmentNodeStore (org.apache.jackrabbit.oak.segment.SegmentNodeStore)15 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)13 SegmentGCOptions (org.apache.jackrabbit.oak.segment.compaction.SegmentGCOptions)13 InvalidFileStoreVersionException (org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException)12 TemporaryFileStore (org.apache.jackrabbit.oak.segment.test.TemporaryFileStore)11 Blob (org.apache.jackrabbit.oak.api.Blob)10 DefaultStatisticsProvider (org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider)10 ByteArrayInputStream (java.io.ByteArrayInputStream)9 FileStoreBuilder (org.apache.jackrabbit.oak.segment.file.FileStoreBuilder)9 Before (org.junit.Before)9 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)8 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)7