use of org.neo4j.kernel.impl.store.record.NeoStoreRecord in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportRelationshipWithReferenceToTheGraphGlobalChain.
@Test
public void shouldReportRelationshipWithReferenceToTheGraphGlobalChain() throws Exception {
// given
OwnerCheck decorator = new OwnerCheck(true);
RecordCheck<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport> relationshipChecker = decorator.decorateRelationshipChecker(dummyRelationshipChecker());
RecordCheck<NeoStoreRecord, ConsistencyReport.NeoStoreConsistencyReport> neoStoreCheck = decorator.decorateNeoStoreChecker(dummyNeoStoreCheck());
RecordAccessStub records = new RecordAccessStub();
NeoStoreRecord master = records.add(new NeoStoreRecord());
master.setNextProp(7);
RelationshipRecord relationship = records.add(inUse(new RelationshipRecord(1, 0, 1, 0)));
relationship.setNextProp(7);
// when
ConsistencyReport.NeoStoreConsistencyReport masterReport = check(ConsistencyReport.NeoStoreConsistencyReport.class, neoStoreCheck, master, records);
ConsistencyReport.RelationshipConsistencyReport relationshipReport = check(ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship, records);
// then
verifyZeroInteractions(masterReport);
verify(relationshipReport).multipleOwners(master);
}
use of org.neo4j.kernel.impl.store.record.NeoStoreRecord in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportNodeStoreReferencingSameChainAsRelationship.
@Test
public void shouldReportNodeStoreReferencingSameChainAsRelationship() throws Exception {
// given
OwnerCheck decorator = new OwnerCheck(true);
RecordCheck<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport> relationshipChecker = decorator.decorateRelationshipChecker(dummyRelationshipChecker());
RecordCheck<NeoStoreRecord, ConsistencyReport.NeoStoreConsistencyReport> neoStoreCheck = decorator.decorateNeoStoreChecker(dummyNeoStoreCheck());
RecordAccessStub records = new RecordAccessStub();
NeoStoreRecord master = records.add(new NeoStoreRecord());
master.setNextProp(7);
RelationshipRecord relationship = records.add(inUse(new RelationshipRecord(1, 0, 1, 0)));
relationship.setNextProp(7);
// when
ConsistencyReport.RelationshipConsistencyReport relationshipReport = check(ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship, records);
ConsistencyReport.NeoStoreConsistencyReport masterReport = check(ConsistencyReport.NeoStoreConsistencyReport.class, neoStoreCheck, master, records);
// then
verifyZeroInteractions(relationshipReport);
verify(masterReport).multipleOwners(relationship);
}
use of org.neo4j.kernel.impl.store.record.NeoStoreRecord in project neo4j by neo4j.
the class MetaDataStoreCheckTest method shouldReportPropertyNotFirstInChain.
@Test
public void shouldReportPropertyNotFirstInChain() throws Exception {
// given
NeoStoreRecord record = new NeoStoreRecord();
PropertyRecord property = add(inUse(new PropertyRecord(7)));
property.setPrevProp(6);
record.setNextProp(property.getId());
// when
ConsistencyReport.NeoStoreConsistencyReport report = check(record);
// then
verify(report).propertyNotFirstInChain(property);
verifyNoMoreInteractions(report);
}
use of org.neo4j.kernel.impl.store.record.NeoStoreRecord in project neo4j by neo4j.
the class CheckTxLogsTest method shouldReportNeoStoreInconsistenciesFromDifferentLogs.
@Test
public void shouldReportNeoStoreInconsistenciesFromDifferentLogs() throws IOException {
// Given
File log1 = logFile(1);
File log2 = logFile(2);
File log3 = logFile(3);
writeTxContent(log1, 0, new Command.NeoStoreCommand(new NeoStoreRecord(), createNeoStoreRecord(42)), new Command.PropertyCommand(propertyRecord(5, false, -1, -1), propertyRecord(5, true, -1, -1, 777)), new Command.NeoStoreCommand(createNeoStoreRecord(42), createNeoStoreRecord(21)));
writeTxContent(log2, 0, new Command.NeoStoreCommand(createNeoStoreRecord(12), createNeoStoreRecord(21)));
writeTxContent(log3, 0, new Command.NeoStoreCommand(createNeoStoreRecord(13), createNeoStoreRecord(21)));
CapturingInconsistenciesHandler handler = new CapturingInconsistenciesHandler();
CheckTxLogs checker = new CheckTxLogs(System.out, fsRule.get());
// When
checker.scan(new PhysicalLogFiles(storeDirectory, fsRule.get()), handler, NEO_STORE);
// Then
assertEquals(2, handler.recordInconsistencies.size());
NeoStoreRecord seenRecord1 = (NeoStoreRecord) handler.recordInconsistencies.get(0).committed.record();
NeoStoreRecord currentRecord1 = (NeoStoreRecord) handler.recordInconsistencies.get(0).current.record();
assertEquals(21, seenRecord1.getNextProp());
assertEquals(12, currentRecord1.getNextProp());
NeoStoreRecord seenRecord2 = (NeoStoreRecord) handler.recordInconsistencies.get(1).committed.record();
NeoStoreRecord currentRecord2 = (NeoStoreRecord) handler.recordInconsistencies.get(1).current.record();
assertEquals(21, seenRecord2.getNextProp());
assertEquals(13, currentRecord2.getNextProp());
}
use of org.neo4j.kernel.impl.store.record.NeoStoreRecord in project neo4j by neo4j.
the class CheckTxLogsTest method createNeoStoreRecord.
private NeoStoreRecord createNeoStoreRecord(int nextProp) {
NeoStoreRecord neoStoreRecord = new NeoStoreRecord();
neoStoreRecord.setNextProp(nextProp);
return neoStoreRecord;
}
Aggregations