use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class BatchingTransactionAppenderConcurrencyTest method tx.
protected TransactionToApply tx() {
NodeRecord before = new NodeRecord(0);
NodeRecord after = new NodeRecord(0);
after.setInUse(true);
Command.NodeCommand nodeCommand = new Command.NodeCommand(before, after);
PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation(asList((Command) nodeCommand));
tx.setHeader(new byte[0], 0, 0, 0, 0, 0, 0);
return new TransactionToApply(tx);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class BatchingTransactionAppenderTest method singleCreateNodeCommand.
private Collection<StorageCommand> singleCreateNodeCommand(long id) {
Collection<StorageCommand> commands = new ArrayList<>();
NodeRecord before = new NodeRecord(id);
NodeRecord after = new NodeRecord(id);
after.setInUse(true);
commands.add(new NodeCommand(before, after));
return commands;
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class NeoStoreTransactionApplierTest method shouldInvalidateTheCacheWhenTheNodeBecomesDense.
@Test
public void shouldInvalidateTheCacheWhenTheNodeBecomesDense() throws Exception {
// given
final BatchTransactionApplier applier = newApplier(false);
final NodeRecord before = new NodeRecord(11);
before.setLabelField(42, Arrays.asList(one));
before.setInUse(true);
before.setDense(false);
final NodeRecord after = new NodeRecord(12);
after.setInUse(true);
after.setDense(true);
after.setLabelField(42, Arrays.asList(one, two, three));
final Command.NodeCommand command = new Command.NodeCommand(before, after);
// when
boolean result = apply(applier, command::handle, transactionToApply);
// then
assertFalse(result);
verify(lockService, times(1)).acquireNodeLock(command.getKey(), LockService.LockType.WRITE_LOCK);
verify(nodeStore, times(1)).updateRecord(after);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class LogEntryParserV2_2Test method shouldParseCommandsUsingAGivenFactory.
@Test
public void shouldParseCommandsUsingAGivenFactory() throws IOException {
// given
Command.NodeCommand nodeCommand = new Command.NodeCommand(new NodeRecord(0), new NodeRecord(0));
final LogEntryCommand command = new LogEntryCommand(version, nodeCommand);
final InMemoryClosableChannel channel = new InMemoryClosableChannel();
nodeCommand.serialize(channel);
channel.getCurrentPosition(marker);
// when
final LogEntryParser parser = version.entryParser(LogEntryByteCodes.COMMAND);
final LogEntry logEntry = parser.parse(version, channel, marker, commandReader);
// then
assertEquals(command, logEntry);
assertFalse(parser.skip());
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class VersionAwareLogEntryReaderTest method shouldParseAnOldCommandLogEntry.
@Test
public void shouldParseAnOldCommandLogEntry() throws IOException {
// given
LogEntryVersion version = LogEntryVersion.V2_1;
Command.NodeCommand nodeCommand = new Command.NodeCommand(new NodeRecord(10), new NodeRecord(10));
final LogEntryCommand command = new LogEntryCommand(version, nodeCommand);
final InMemoryClosableChannel channel = new InMemoryClosableChannel();
channel.put(version.byteCode());
channel.put(LogEntryByteCodes.COMMAND);
// ignored data
// identifier ignored
channel.putInt(42);
// actual used data
nodeCommand.serialize(channel);
// when
final LogEntry logEntry = logEntryReader.readLogEntry(channel);
// then
assertTrue(logEntry instanceof IdentifiableLogEntry);
assertEquals(command, ((IdentifiableLogEntry) logEntry).getEntry());
}
Aggregations