use of org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage in project neo4j by neo4j.
the class LuceneSchemaIndexProvider method getInitialState.
@Override
public InternalIndexState getInitialState(long indexId, NewIndexDescriptor descriptor) {
PartitionedIndexStorage indexStorage = getIndexStorage(indexId);
String failure = indexStorage.getStoredIndexFailure();
if (failure != null) {
return InternalIndexState.FAILED;
}
try {
return indexIsOnline(indexStorage, descriptor) ? InternalIndexState.ONLINE : InternalIndexState.POPULATING;
} catch (IOException e) {
log.error("Failed to open index:" + indexId + ", requesting re-population.", e);
return InternalIndexState.POPULATING;
}
}
use of org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage in project neo4j by neo4j.
the class LuceneLabelScanStoreTest method createLabelScanStore.
@Override
protected LabelScanStore createLabelScanStore(FileSystemAbstraction fs, File rootFolder, List<NodeLabelUpdate> existingData, boolean usePersistentStore, boolean readOnly, LabelScanStore.Monitor monitor) {
DirectoryFactory directoryFactory = usePersistentStore ? DirectoryFactory.PERSISTENT : inMemoryDirectoryFactory;
indexStorage = new PartitionedIndexStorage(directoryFactory, fs, rootFolder, LuceneLabelScanIndexBuilder.DEFAULT_INDEX_IDENTIFIER, false);
Config config = Config.defaults().with(MapUtil.stringMap(GraphDatabaseSettings.read_only.name(), String.valueOf(readOnly)));
LuceneLabelScanIndexBuilder indexBuilder = LuceneLabelScanIndexBuilder.create().withDirectoryFactory(directoryFactory).withIndexStorage(indexStorage).withOperationalMode(OperationalMode.single).withConfig(config).withDocumentFormat(documentFormat);
return new LuceneLabelScanStore(indexBuilder, asStream(existingData), monitor);
}
use of org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage in project neo4j by neo4j.
the class ConstraintIndexFailureIT method storeIndexFailure.
private void storeIndexFailure(String failure) throws IOException {
File luceneRootDirectory = new File(storeDir.directory(), "schema/index/lucene");
PartitionedIndexStorage indexStorage = LuceneIndexStorageBuilder.create().withFileSystem(fileSystemRule.get()).withIndexRootFolder(luceneRootDirectory).withIndexIdentifier("1").build();
indexStorage.storeIndexFailure(failure);
}
use of org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage in project neo4j by neo4j.
the class DatabaseIndexIntegrationTest method createTestLuceneIndex.
private WritableTestDatabaseIndex createTestLuceneIndex(DirectoryFactory dirFactory, File folder) throws IOException {
PartitionedIndexStorage indexStorage = new PartitionedIndexStorage(dirFactory, fileSystemRule.get(), folder, "test", false);
WritableTestDatabaseIndex index = new WritableTestDatabaseIndex(indexStorage);
index.create();
index.open();
return index;
}
use of org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage in project neo4j by neo4j.
the class AccessUniqueDatabaseIndexTest method shouldConsiderWholeTransactionForValidatingUniqueness.
@Test
void shouldConsiderWholeTransactionForValidatingUniqueness() throws Exception {
// given
PartitionedIndexStorage indexStorage = getIndexStorage();
LuceneIndexAccessor accessor = createAccessor(indexStorage);
// when
updateAndCommit(accessor, singletonList(add(1L, "value1")));
updateAndCommit(accessor, singletonList(add(2L, "value2")));
updateAndCommit(accessor, asList(change(1L, "value1", "value2"), change(2L, "value2", "value1")));
accessor.close();
// then
assertEquals(singletonList(2L), getAllNodes(indexStorage, "value1"));
assertEquals(singletonList(1L), getAllNodes(indexStorage, "value2"));
}
Aggregations