use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class CommitProcessTracingIT method tracePageCacheAccessOnCommandCreation.
@Test
void tracePageCacheAccessOnCommandCreation() throws KernelException {
long sourceId;
try (Transaction transaction = database.beginTx()) {
sourceId = transaction.createNode(Label.label("a")).getId();
transaction.commit();
}
var pageCacheTracer = new DefaultPageCacheTracer();
try (var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("tracePageCacheAccessOnCommandCreation"));
var reader = storageEngine.newReader()) {
assertZeroCursor(cursorContext);
try (CommandCreationContext context = storageEngine.newCommandCreationContext(INSTANCE)) {
context.initialize(cursorContext);
List<StorageCommand> commands = new ArrayList<>();
var txState = new TxState();
txState.nodeDoAddLabel(1, sourceId);
storageEngine.createCommands(commands, txState, reader, context, IGNORE, LockTracer.NONE, 0, NO_DECORATION, cursorContext, INSTANCE);
}
assertCursor(cursorContext, 2);
}
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class PhysicalLogCommandReadersTest method assertCanReadRelGroup.
private static void assertCanReadRelGroup(CommandReader reader) throws IOException {
StorageCommand command = reader.read(channelWithRelGroupRecord());
assertValidRelGroupCommand(command);
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method readRelationshipCommandWithSecondaryUnit.
@Test
void readRelationshipCommandWithSecondaryUnit() throws IOException {
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipRecord before = new RelationshipRecord(42);
before.initialize(true, 0, 1, 2, 3, 4, 5, 6, 7, true, true);
before.setSecondaryUnitIdOnLoad(47);
RelationshipRecord after = new RelationshipRecord(42);
after.initialize(true, 0, 1, 8, 3, 4, 5, 6, 7, true, true);
new Command.RelationshipCommand(writer(), before, after).serialize(channel);
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipCommand);
Command.RelationshipCommand relationshipCommand = (Command.RelationshipCommand) command;
assertBeforeAndAfterEquals(relationshipCommand, before, after);
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method shouldReadLabelCommand.
@Test
void shouldReadLabelCommand() throws Exception {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
LabelTokenRecord before = new LabelTokenRecord(42);
LabelTokenRecord after = before.copy();
after.initialize(true, 13);
after.setCreated();
new Command.LabelTokenCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.LabelTokenCommand);
Command.LabelTokenCommand labelTokenCommand = (Command.LabelTokenCommand) command;
// Then
assertBeforeAndAfterEquals(labelTokenCommand, before, after);
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class LogCommandSerializationV4_0Test method shouldReadInternalRelationshipTypeLabelCommand.
@Test
void shouldReadInternalRelationshipTypeLabelCommand() throws Exception {
// Given
InMemoryClosableChannel channel = new InMemoryClosableChannel();
RelationshipTypeTokenRecord before = new RelationshipTypeTokenRecord(42);
RelationshipTypeTokenRecord after = before.copy();
after.initialize(true, 13);
after.setCreated();
after.setInternal(true);
new Command.RelationshipTypeTokenCommand(writer(), before, after).serialize(channel);
// When
CommandReader reader = createReader();
StorageCommand command = reader.read(channel);
assertTrue(command instanceof Command.RelationshipTypeTokenCommand);
Command.RelationshipTypeTokenCommand relationshipTypeTokenCommand = (Command.RelationshipTypeTokenCommand) command;
// Then
assertBeforeAndAfterEquals(relationshipTypeTokenCommand, before, after);
}
Aggregations