nodeCommands[i++] = new Command.NodeCommand( change.getBefore(), record );
cmd.serialize( channel ); Command.NodeCommand result = (Command.NodeCommand) commandReader.read( channel ); assertThat( result.getMode(), equalTo( cmd.getMode() ) ); assertThat( result.getBefore(), equalTo( cmd.getBefore() ) ); assertThat( result.getAfter(), equalTo( cmd.getAfter() ) ); assertThat( result.getBefore().isCreated(), equalTo( cmd.getBefore().isCreated() ) ); assertThat( result.getAfter().isCreated(), equalTo( cmd.getAfter().isCreated() ) ); assertThat( result.getBefore().isDense(), equalTo( cmd.getBefore().isDense() ) ); assertThat( result.getAfter().isDense(), equalTo( cmd.getAfter().isDense()) ); assertThat( labels( result.getBefore() ), equalTo( labels( cmd.getBefore() ) ) ); assertThat( labels( result.getAfter() ), equalTo( labels( cmd.getAfter() ) ) ); assertThat( result.getBefore().getDynamicLabelRecords(), equalTo( cmd.getBefore().getDynamicLabelRecords() ) ); assertThat( result.getAfter().getDynamicLabelRecords(), equalTo( cmd.getAfter().getDynamicLabelRecords() ) ); assertThat( result.getBefore().requiresSecondaryUnit(), equalTo( cmd.getBefore().requiresSecondaryUnit() ) ); assertThat( result.getBefore().hasSecondaryUnitId(), equalTo( cmd.getBefore().hasSecondaryUnitId() ) ); assertThat( result.getBefore().getSecondaryUnitId(), equalTo( cmd.getBefore().getSecondaryUnitId() ) ); assertThat( result.getAfter().requiresSecondaryUnit(), equalTo( cmd.getAfter().requiresSecondaryUnit() ) ); assertThat( result.getAfter().hasSecondaryUnitId(), equalTo( cmd.getAfter().hasSecondaryUnitId() ) ); assertThat( result.getAfter().getSecondaryUnitId(), equalTo( cmd.getAfter().getSecondaryUnitId() ) );
@Override public boolean visitNodeCommand( Command.NodeCommand command ) { // for label store updates NodeRecord before = command.getBefore(); NodeRecord after = command.getAfter(); NodeLabels labelFieldBefore = parseLabelsField( before ); NodeLabels labelFieldAfter = parseLabelsField( after ); if ( !(labelFieldBefore.isInlined() && labelFieldAfter.isInlined() && before.getLabelField() == after.getLabelField()) ) { long[] labelsBefore = labelFieldBefore.getIfLoaded(); long[] labelsAfter = labelFieldAfter.getIfLoaded(); if ( labelsBefore != null && labelsAfter != null ) { if ( labelUpdates == null ) { labelUpdates = new ArrayList<>(); } labelUpdates.add( NodeLabelUpdate.labelChanges( command.getKey(), labelsBefore, labelsAfter, txId ) ); } } // for indexes return indexUpdatesExtractor.visitNodeCommand( command ); }
nodeCommands[i++] = new Command.NodeCommand( change.getBefore(), record );
@Override public boolean visitNodeCommand( Command.NodeCommand command ) { // for label store updates NodeRecord before = command.getBefore(); NodeRecord after = command.getAfter(); NodeLabels labelFieldBefore = parseLabelsField( before ); NodeLabels labelFieldAfter = parseLabelsField( after ); if ( !(labelFieldBefore.isInlined() && labelFieldAfter.isInlined() && before.getLabelField() == after.getLabelField()) ) { long[] labelsBefore = labelFieldBefore.getIfLoaded(); long[] labelsAfter = labelFieldAfter.getIfLoaded(); if ( labelsBefore != null && labelsAfter != null ) { if ( labelUpdates == null ) { labelUpdates = new ArrayList<>(); } labelUpdates.add( NodeLabelUpdate.labelChanges( command.getKey(), labelsBefore, labelsAfter, txId ) ); } } // for indexes return indexUpdatesExtractor.visitNodeCommand( command ); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
@Override public boolean visitNodeCommand( Command.NodeCommand command ) { // acquire lock lockGroup.add( lockService.acquireNodeLock( command.getKey(), LockService.LockType.WRITE_LOCK ) ); // update store updateStore( neoStores.getNodeStore(), command ); return false; }
public void add( NodeRecord before, NodeRecord after ) { Command.NodeCommand command = new Command.NodeCommand(); command.init( before, after ); addCommand( command ); }
@Override public boolean visitNodeCommand( NodeCommand command ) { nodeCommandsById.put( command.getKey(), command ); if ( !hasUpdates && mayResultInIndexUpdates( command ) ) { hasUpdates = true; } return false; }
private static boolean mayResultInIndexUpdates( NodeCommand command ) { long before = command.getBefore().getLabelField(); long after = command.getAfter().getLabelField(); return before != after || // Because we don't know here, there may have been changes to a dynamic label record // even though it still points to the same one fieldPointsToDynamicRecordOfLabels( before ) || fieldPointsToDynamicRecordOfLabels( after ); }
@Override public boolean visitNodeCommand( NodeCommand command ) { NodeStore nodeStore = neoStores.getNodeStore(); track( nodeStore, command ); track( nodeStore.getDynamicLabelStore(), command.getAfter().getDynamicLabelRecords() ); return false; }
assertTrue( format.node().prepared( ((NodeCommand) command).getAfter() ) ); nodes++;
nodeStore.updateRecord( inUseNode ); Command.NodeCommand nodeCommand = new Command.NodeCommand( inUseNode, notInUseNode ); PropertyRecord nodePropertyBlocks = new PropertyRecord( nodePropertyId ); nodePropertyBlocks.setNodeId( nodeId );
NodeRecord after = new NodeRecord( nodeId ); after.setInUse( true ); visitor.visit( new Command.NodeCommand( new NodeRecord( nodeId ), after ) ); return null; } );
tracker.visitNodeCommand( new NodeCommand( new NodeRecord( node.getId() ), node ) ); tracker.visitRelationshipCommand( new RelationshipCommand( new RelationshipRecord( relationship.getId() ), relationship ) );