use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class RelationshipRecordFormatTest method useFixedReferenceFormatWhenRecordCanFitInRecordSizeRecord.
@Test
public void useFixedReferenceFormatWhenRecordCanFitInRecordSizeRecord() throws IOException {
RelationshipRecord source = new RelationshipRecord(1);
RelationshipRecord target = new RelationshipRecord(1);
source.initialize(true, randomFixedReference(), randomFixedReference(), randomFixedReference(), randomShortType(), randomFixedReference(), randomFixedReference(), randomFixedReference(), randomFixedReference(), true, true);
writeReadRecord(source, target, RelationshipRecordFormat.FIXED_FORMAT_RECORD_SIZE);
assertTrue("Record should use fixed reference if can fit in format record.", target.isUseFixedReferences());
verifySameReferences(source, target);
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class RelationshipRecordFormatTest method useVariableLengthFormatWhenTypeIsTooBig.
@Test
public void useVariableLengthFormatWhenTypeIsTooBig() throws IOException {
RelationshipRecord source = new RelationshipRecord(1);
RelationshipRecord target = new RelationshipRecord(1);
source.initialize(true, randomFixedReference(), randomFixedReference(), randomFixedReference(), 1 << 16, randomFixedReference(), randomFixedReference(), randomFixedReference(), randomFixedReference(), true, true);
writeReadRecord(source, target);
assertFalse("Record should use variable length format.", target.isUseFixedReferences());
verifySameReferences(source, target);
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0Test method readRelationshipCommandWithSecondaryUnit.
@Test
public void readRelationshipCommandWithSecondaryUnit() throws IOException {
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipRecord before = new RelationshipRecord(42, true, 1, 2, 3, 4, 5, 6, 7, true, true);
before.setRequiresSecondaryUnit(true);
before.setSecondaryUnitId(47);
RelationshipRecord after = new RelationshipRecord(42, true, 1, 8, 3, 4, 5, 6, 7, true, true);
new Command.RelationshipCommand(before, after).serialize(channel);
PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0();
Command command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipCommand);
Command.RelationshipCommand relationshipCommand = (Command.RelationshipCommand) command;
assertEquals(before, relationshipCommand.getBefore());
verifySecondaryUnit(before, relationshipCommand.getBefore());
assertEquals(after, relationshipCommand.getAfter());
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldApplyRelationshipCommandToTheStoreAndInvalidateTheCache.
@Test
public void shouldApplyRelationshipCommandToTheStoreAndInvalidateTheCache() throws Exception {
// given
final BatchTransactionApplier applier = newApplier(false);
final RelationshipRecord before = new RelationshipRecord(12);
final RelationshipRecord record = new RelationshipRecord(12, 3, 4, 5);
record.setInUse(false);
final Command command = new Command.RelationshipCommand(before, record);
// when
boolean result = apply(applier, command::handle, transactionToApply);
// then
assertFalse(result);
verify(relationshipStore, times(1)).updateRecord(record);
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class BatchInserterImpl method setRelationshipProperties.
@Override
public void setRelationshipProperties(long rel, Map<String, Object> properties) {
RelationshipRecord record = recordAccess.getRelRecords().getOrLoad(rel, null).forChangingData();
if (record.getNextProp() != Record.NO_NEXT_PROPERTY.intValue()) {
propertyDeletor.deletePropertyChain(record, recordAccess.getPropertyRecords());
}
record.setNextProp(propertyCreator.createPropertyChain(record, propertiesIterator(properties), recordAccess.getPropertyRecords()));
flushStrategy.flush();
}
Aggregations