use of org.neo4j.kernel.impl.api.index.IndexSamplingConfig in project neo4j by neo4j.
the class TokenIndexPopulatorCompatibility method shouldReportInitialStateAsFailedIfPopulationFailed.
@Test
public void shouldReportInitialStateAsFailedIfPopulationFailed() throws Exception {
// GIVEN
IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig(Config.defaults());
withPopulator(indexProvider.getPopulator(descriptor, indexSamplingConfig, heapBufferFactory(1024), INSTANCE, tokenNameLookup), p -> {
String failure = "The contrived failure";
// WHEN
p.markAsFailed(failure);
p.close(false, NULL);
// THEN
assertEquals(FAILED, indexProvider.getInitialState(descriptor, NULL));
}, false);
}
use of org.neo4j.kernel.impl.api.index.IndexSamplingConfig in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldNotReportIndexInconsistenciesIfIndexIsFailed.
@Test
void shouldNotReportIndexInconsistenciesIfIndexIsFailed() throws Exception {
// this test fails all indexes, and then destroys a record and makes sure we only get a failure for
// the label scan store but not for any index
// given
DirectStoreAccess storeAccess = fixture.directStoreAccess();
// fail all indexes
Iterator<IndexDescriptor> rules = getValueIndexDescriptors();
while (rules.hasNext()) {
IndexDescriptor rule = rules.next();
IndexSamplingConfig samplingConfig = new IndexSamplingConfig(Config.defaults());
IndexPopulator populator = storeAccess.indexes().lookup(rule.getIndexProvider()).getPopulator(rule, samplingConfig, heapBufferFactory(1024), INSTANCE, tokenNameLookup);
populator.markAsFailed("Oh noes! I was a shiny index and then I was failed");
populator.close(false, NULL);
}
for (Long indexedNodeId : indexedNodes) {
storeAccess.nativeStores().getNodeStore().updateRecord(notInUse(new NodeRecord(indexedNodeId).initialize(false, -1, false, -1, 0)), NULL);
}
// when
ConsistencySummaryStatistics stats = check();
// then
// the label scan is pointing to 2 nodes not in use
on(stats).verify(RecordType.LABEL_SCAN_DOCUMENT, 2).verify(RecordType.COUNTS, 2).andThatsAllFolks();
}
use of org.neo4j.kernel.impl.api.index.IndexSamplingConfig in project neo4j by neo4j.
the class IndexIteratorIT method setUp.
@BeforeEach
void setUp() throws IOException {
var label = label("any");
var propertyName = "property";
try (var tx = database.beginTx()) {
var node = tx.createNode(label);
node.setProperty(propertyName, "nodeValue");
tx.commit();
}
try (var tx = database.beginTx()) {
tx.schema().indexFor(label).on(propertyName).withName(INDEX_NAME).create();
tx.commit();
}
try (var transaction = database.beginTx()) {
transaction.schema().awaitIndexesOnline(10, MINUTES);
}
var neoStores = storageEngine.testAccessNeoStores();
indexAccessors = new IndexAccessors(providerMap, neoStores, new IndexSamplingConfig(config), PageCacheTracer.NULL, SIMPLE_NAME_LOOKUP, () -> KernelVersion.LATEST);
pageCacheTracer = new DefaultPageCacheTracer();
}
use of org.neo4j.kernel.impl.api.index.IndexSamplingConfig in project neo4j by neo4j.
the class NodeCheckerIT method prepareContext.
private void prepareContext() throws Exception {
var neoStores = storageEngine.testAccessNeoStores();
var indexAccessors = new IndexAccessors(providerMap, neoStores, new IndexSamplingConfig(config), PageCacheTracer.NULL, SIMPLE_NAME_LOOKUP, () -> KernelVersion.LATEST);
context = new CheckerContext(neoStores, indexAccessors, execution, mock(ConsistencyReport.Reporter.class, RETURNS_MOCKS), CacheAccess.EMPTY, tokenHolders, mock(RecordLoading.class), mock(CountsState.class), mock(NodeBasedMemoryLimiter.class), ProgressMonitorFactory.NONE.multipleParts("test"), pageCache, pageCacheTracer, INSTANCE, DebugContext.NO_DEBUG, ConsistencyFlags.DEFAULT);
context.initialize();
}
use of org.neo4j.kernel.impl.api.index.IndexSamplingConfig in project neo4j by neo4j.
the class RelationshipCheckerIT method prepareContext.
private void prepareContext() throws Exception {
var neoStores = storageEngine.testAccessNeoStores();
var indexAccessors = new IndexAccessors(providerMap, neoStores, new IndexSamplingConfig(config), PageCacheTracer.NULL, SIMPLE_NAME_LOOKUP, () -> KernelVersion.LATEST);
context = new CheckerContext(neoStores, indexAccessors, execution, mock(ConsistencyReport.Reporter.class, RETURNS_MOCKS), CacheAccess.EMPTY, tokenHolders, mock(RecordLoading.class), mock(CountsState.class), mock(NodeBasedMemoryLimiter.class), ProgressMonitorFactory.NONE.multipleParts("test"), pageCache, pageCacheTracer, INSTANCE, DebugContext.NO_DEBUG, ConsistencyFlags.DEFAULT);
context.initialize();
}
Aggregations