use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class RepeatedRepositorySidegradeTest method doUpgradeRepository.
@Override
protected void doUpgradeRepository(File source, NodeStore target, boolean skipInit) throws RepositoryException, IOException {
FileStore fileStore;
try {
fileStore = fileStoreBuilder(source).build();
} catch (InvalidFileStoreVersionException e) {
throw new IllegalStateException(e);
}
SegmentNodeStore segmentNodeStore = SegmentNodeStoreBuilders.builder(fileStore).build();
try {
final RepositorySidegrade repositoryUpgrade = new RepositorySidegrade(segmentNodeStore, target);
NodeBuilder builder = target.getRoot().builder();
builder.child("foo").child("bar");
target.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
repositoryUpgrade.copy();
} catch (CommitFailedException e) {
throw new RepositoryException(e);
} finally {
fileStore.close();
}
}
use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class FailoverSslTestIT method synchronizeAndCompareHead.
private boolean synchronizeAndCompareHead(StandbyServerSync serverSync, StandbyClientSync clientSync) throws Exception {
FileStore storeS = serverFileStore.fileStore();
FileStore storeC = clientFileStore.fileStore();
NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
serverSync.start();
addTestContent(store, "server");
// this speeds up the test a little bit...
storeS.flush();
clientSync.run();
return storeS.getHead().equals(storeC.getHead());
}
use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class IncludeExcludeSidegradeTest method upgradeRepository.
@Before
public synchronized void upgradeRepository() throws Exception {
if (targetNodeStore == null) {
File directory = getTestDirectory();
File source = new File(directory, "source");
source.mkdirs();
FileStore fileStore = fileStoreBuilder(source).build();
SegmentNodeStore segmentNodeStore = SegmentNodeStoreBuilders.builder(fileStore).build();
RepositoryImpl repository = (RepositoryImpl) new Jcr(new Oak(segmentNodeStore)).createRepository();
Session session = repository.login(CREDENTIALS);
try {
createSourceContent(session);
} finally {
session.save();
session.logout();
repository.shutdown();
fileStore.close();
}
final NodeStore target = getTargetNodeStore();
doUpgradeRepository(source, target);
targetNodeStore = target;
}
}
use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class OakDirectoryTest method largeFile.
@Test
public void largeFile() throws Exception {
FileStore store = FileStoreBuilder.fileStoreBuilder(tempFolder.getRoot()).withMemoryMapping(false).withBlobStore(new BlackHoleBlobStore()).build();
SegmentNodeStore nodeStore = SegmentNodeStoreBuilders.builder(store).build();
IndexDefinition defn = new IndexDefinition(INITIAL_CONTENT, EmptyNodeState.EMPTY_NODE, "/foo");
Directory directory = new OakDirectory(nodeStore.getRoot().builder(), defn, false);
long expectedSize = ONE_GB * 2 + ONE_MB;
String fileName = "test";
writeFile(directory, fileName, expectedSize);
assertEquals(expectedSize, directory.fileLength(fileName));
IndexInput input = directory.openInput(fileName, IOContext.DEFAULT);
readInputToEnd(expectedSize, input);
store.close();
}
use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class NodeStoreFixtureProvider method configureSegment.
private static NodeStore configureSegment(Options options, BlobStore blobStore, StatisticsProvider statisticsProvider, Closer closer, boolean readOnly) throws IOException, InvalidFileStoreVersionException {
String path = options.getOptionBean(CommonOptions.class).getStoreArg();
FileStoreBuilder builder = fileStoreBuilder(new File(path)).withMaxFileSize(256);
if (blobStore != null) {
builder.withBlobStore(blobStore);
}
NodeStore nodeStore;
if (readOnly) {
ReadOnlyFileStore fileStore = builder.withStatisticsProvider(statisticsProvider).buildReadOnly();
closer.register(fileStore);
nodeStore = SegmentNodeStoreBuilders.builder(fileStore).build();
} else {
FileStore fileStore = builder.withStatisticsProvider(statisticsProvider).build();
closer.register(fileStore);
nodeStore = SegmentNodeStoreBuilders.builder(fileStore).build();
}
return nodeStore;
}
Aggregations