use of org.neo4j.kernel.api.labelscan.LabelScanStore in project neo4j by neo4j.
the class ReadReplicaReplicationIT method gatherLabelScanStoreFiles.
private void gatherLabelScanStoreFiles(GraphDatabaseAPI db, Set<Path> labelScanStoreFiles) {
Path dbStoreDirectory = Paths.get(db.getStoreDir()).toAbsolutePath();
LabelScanStore labelScanStore = db.getDependencyResolver().resolveDependency(LabelScanStore.class);
try (ResourceIterator<File> files = labelScanStore.snapshotStoreFiles()) {
Path relativePath = dbStoreDirectory.relativize(files.next().toPath().toAbsolutePath());
labelScanStoreFiles.add(relativePath);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of org.neo4j.kernel.api.labelscan.LabelScanStore in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportLabelScanStoreInconsistencies.
@Test
public void shouldReportLabelScanStoreInconsistencies() throws Exception {
// given
GraphStoreFixture.IdGenerator idGenerator = fixture.idGenerator();
long nodeId1 = idGenerator.node();
long labelId = idGenerator.label() - 1;
LabelScanStore labelScanStore = fixture.directStoreAccess().labelScanStore();
Iterable<NodeLabelUpdate> nodeLabelUpdates = asIterable(labelChanges(nodeId1, new long[] {}, new long[] { labelId }));
write(labelScanStore, nodeLabelUpdates);
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.LABEL_SCAN_DOCUMENT, 1).andThatsAllFolks();
}
use of org.neo4j.kernel.api.labelscan.LabelScanStore in project neo4j by neo4j.
the class LabelScanStoreStartupIT method scanStoreRecreateCorruptedIndexOnStartup.
@Test
public void scanStoreRecreateCorruptedIndexOnStartup() throws IOException {
LabelScanStore labelScanStore = getLabelScanStore();
createTestNode();
long[] labels = readNodesForLabel(labelScanStore);
assertEquals("Label scan store see 1 label for node", 1, labels.length);
labelScanStore.force(IOLimiter.unlimited());
labelScanStore.shutdown();
corruptLabelScanStoreFiles(dbRule.getStoreDirFile());
labelScanStore.init();
labelScanStore.start();
long[] rebuildLabels = readNodesForLabel(labelScanStore);
assertArrayEquals("Store should rebuild corrupted index", labels, rebuildLabels);
}
use of org.neo4j.kernel.api.labelscan.LabelScanStore in project neo4j by neo4j.
the class LabelScanStoreStartupIT method scanStoreStartWithoutExistentIndex.
@Test
public void scanStoreStartWithoutExistentIndex() throws IOException {
LabelScanStore labelScanStore = getLabelScanStore();
labelScanStore.shutdown();
deleteLabelScanStoreFiles(dbRule.getStoreDirFile());
labelScanStore.init();
labelScanStore.start();
checkLabelScanStoreAccessible(labelScanStore);
}
use of org.neo4j.kernel.api.labelscan.LabelScanStore in project neo4j by neo4j.
the class LuceneLabelScanStoreBuilder method build.
public LabelScanStore build() {
if (null == labelScanStore) {
// TODO: Replace with kernel extension based lookup
LabelScanStore.Monitor monitor = new LoggingMonitor(logProvider.getLog(LuceneLabelScanStore.class));
LuceneLabelScanIndexBuilder indexBuilder = LuceneLabelScanIndexBuilder.create().withFileSystem(fileSystem).withIndexRootFolder(getStoreDirectory(storeDir)).withConfig(config).withOperationalMode(operationalMode);
labelScanStore = new LuceneLabelScanStore(indexBuilder, new FullLabelStream(storeViewSupplier), monitor);
try {
labelScanStore.init();
labelScanStore.start();
} catch (IOException e) {
// Throw better exception
throw new RuntimeException(e);
}
}
return labelScanStore;
}
Aggregations