Skip to content

Commit

Permalink
Remove notion of XACommand
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaDemianenko committed Nov 3, 2017
1 parent c8508cc commit 444f868
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 14 deletions.
Expand Up @@ -92,7 +92,7 @@ public boolean next() throws IOException
} }


LogEntryCommand command = entry.as(); LogEntryCommand command = entry.as();
entries.add( command.getXaCommand() ); entries.add( command.getCommand() );
} }


PhysicalTransactionRepresentation transaction = new PhysicalTransactionRepresentation( entries ); PhysicalTransactionRepresentation transaction = new PhysicalTransactionRepresentation( entries );
Expand Down
Expand Up @@ -39,7 +39,7 @@ public LogEntryCommand( LogEntryVersion version, StorageCommand command )
this.command = command; this.command = command;
} }


public StorageCommand getXaCommand() public StorageCommand getCommand()
{ {
return command; return command;
} }
Expand Down
Expand Up @@ -115,7 +115,7 @@ public void shouldCallTheVisitorWithTheFoundTransaction() throws IOException


// then // then
PhysicalTransactionRepresentation txRepresentation = PhysicalTransactionRepresentation txRepresentation =
new PhysicalTransactionRepresentation( singletonList( A_COMMAND_ENTRY.getXaCommand() ) ); new PhysicalTransactionRepresentation( singletonList( A_COMMAND_ENTRY.getCommand() ) );
assertEquals( assertEquals(
new CommittedTransactionRepresentation( A_START_ENTRY, txRepresentation, A_COMMIT_ENTRY ), new CommittedTransactionRepresentation( A_START_ENTRY, txRepresentation, A_COMMIT_ENTRY ),
cursor.get() cursor.get()
Expand All @@ -136,7 +136,7 @@ public void shouldSkipCheckPoints() throws IOException


// then // then
PhysicalTransactionRepresentation txRepresentation = PhysicalTransactionRepresentation txRepresentation =
new PhysicalTransactionRepresentation( singletonList( A_COMMAND_ENTRY.getXaCommand() ) ); new PhysicalTransactionRepresentation( singletonList( A_COMMAND_ENTRY.getCommand() ) );
assertEquals( assertEquals(
new CommittedTransactionRepresentation( A_START_ENTRY, txRepresentation, A_COMMIT_ENTRY ), new CommittedTransactionRepresentation( A_START_ENTRY, txRepresentation, A_COMMIT_ENTRY ),
cursor.get() cursor.get()
Expand Down
Expand Up @@ -199,7 +199,7 @@ private void assertHandlesLogTruncation( Command cmd ) throws IOException
try try
{ {
LogEntry logEntry = logEntryReader.readLogEntry( inMemoryChannel ); LogEntry logEntry = logEntryReader.readLogEntry( inMemoryChannel );
StorageCommand command = ((LogEntryCommand) logEntry).getXaCommand(); StorageCommand command = ((LogEntryCommand) logEntry).getCommand();
assertEquals( cmd, command ); assertEquals( cmd, command );
} }
catch ( Exception e ) catch ( Exception e )
Expand Down
Expand Up @@ -201,7 +201,7 @@ public boolean matchesSafely( LogEntryCommand commandEntry )
return false; return false;
} }


Command command = (Command) commandEntry.getXaCommand(); Command command = (Command) commandEntry.getCommand();
return command.getKey() == key && return command.getKey() == key &&
command.getClass().equals( commandClass ); command.getClass().equals( commandClass );
} }
Expand Down
Expand Up @@ -156,7 +156,7 @@ private void verifyThatIndexCreationTransactionIsTheFirstOne() throws Exception


if ( startFound && entry instanceof LogEntryCommand ) if ( startFound && entry instanceof LogEntryCommand )
{ {
commandsInFirstEntry.add( entry.<LogEntryCommand>as().getXaCommand() ); commandsInFirstEntry.add( entry.<LogEntryCommand>as().getCommand() );
} }


if ( entry instanceof LogEntryCommit ) if ( entry instanceof LogEntryCommit )
Expand Down
Expand Up @@ -130,7 +130,7 @@ static Collection<StorageCommand> extractCommands( byte[] commandBytes )
{ {
while ( (entryRead = (LogEntryCommand) reader.readLogEntry( channel )) != null ) while ( (entryRead = (LogEntryCommand) reader.readLogEntry( channel )) != null )
{ {
commands.add( entryRead.getXaCommand() ); commands.add( entryRead.getCommand() );
} }
} }
catch ( IOException e ) catch ( IOException e )
Expand Down
Expand Up @@ -156,7 +156,7 @@ public static TransactionRepresentation read( NetworkReadableClosableChannelNett


while ( (entryRead = (LogEntryCommand) reader.readLogEntry( channel )) != null ) while ( (entryRead = (LogEntryCommand) reader.readLogEntry( channel )) != null )
{ {
commands.add( entryRead.getXaCommand() ); commands.add( entryRead.getCommand() );
} }


PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation( commands ); PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation( commands );
Expand Down
Expand Up @@ -63,7 +63,7 @@ private CommittedTransactionRepresentation newCommittedTransactionRepresentation
new Command.NodeCommand( new NodeRecord( arbitraryRecordId ), new NodeRecord( arbitraryRecordId ) ); new Command.NodeCommand( new NodeRecord( arbitraryRecordId ), new NodeRecord( arbitraryRecordId ) );


PhysicalTransactionRepresentation physicalTransactionRepresentation = PhysicalTransactionRepresentation physicalTransactionRepresentation =
new PhysicalTransactionRepresentation( singletonList( new LogEntryCommand( command ).getXaCommand() ) ); new PhysicalTransactionRepresentation( singletonList( new LogEntryCommand( command ).getCommand() ) );
physicalTransactionRepresentation.setHeader( new byte[]{}, 0, 0, 0, 0, 0, 0 ); physicalTransactionRepresentation.setHeader( new byte[]{}, 0, 0, 0, 0, 0, 0 );


LogEntryStart startEntry = new LogEntryStart( 0, 0, 0L, 0L, new byte[]{}, LogPosition.UNSPECIFIED ); LogEntryStart startEntry = new LogEntryStart( 0, 0, 0L, 0L, new byte[]{}, LogPosition.UNSPECIFIED );
Expand Down
2 changes: 1 addition & 1 deletion enterprise/com/src/main/java/org/neo4j/com/Protocol.java
Expand Up @@ -90,7 +90,7 @@ public TransactionRepresentation read( ChannelBuffer buffer, ByteBuffer temporar
List<StorageCommand> commands = new LinkedList<>(); List<StorageCommand> commands = new LinkedList<>();
while ( (entryRead = (LogEntryCommand) reader.readLogEntry( channel )) != null ) while ( (entryRead = (LogEntryCommand) reader.readLogEntry( channel )) != null )
{ {
commands.add( entryRead.getXaCommand() ); commands.add( entryRead.getCommand() );
} }


PhysicalTransactionRepresentation toReturn = new PhysicalTransactionRepresentation( commands ); PhysicalTransactionRepresentation toReturn = new PhysicalTransactionRepresentation( commands );
Expand Down
3 changes: 2 additions & 1 deletion tools/src/main/java/org/neo4j/tools/dump/DumpLogicalLog.java
Expand Up @@ -44,6 +44,7 @@
import org.neo4j.storageengine.api.StorageCommand; import org.neo4j.storageengine.api.StorageCommand;
import org.neo4j.tools.dump.TransactionLogAnalyzer.Monitor; import org.neo4j.tools.dump.TransactionLogAnalyzer.Monitor;
import org.neo4j.tools.dump.inconsistency.ReportInconsistencies; import org.neo4j.tools.dump.inconsistency.ReportInconsistencies;

import static java.util.TimeZone.getTimeZone; import static java.util.TimeZone.getTimeZone;
import static org.neo4j.helpers.Format.DEFAULT_TIME_ZONE; import static org.neo4j.helpers.Format.DEFAULT_TIME_ZONE;


Expand Down Expand Up @@ -153,7 +154,7 @@ private boolean matches( LogEntry logEntry )
{ {
if ( logEntry instanceof LogEntryCommand ) if ( logEntry instanceof LogEntryCommand )
{ {
if ( matches( ((LogEntryCommand)logEntry).getXaCommand() ) ) if ( matches( ((LogEntryCommand)logEntry).getCommand() ) )
{ {
return true; return true;
} }
Expand Down
2 changes: 1 addition & 1 deletion tools/src/main/java/org/neo4j/tools/txlog/CheckTxLogs.java
Expand Up @@ -207,7 +207,7 @@ private <C extends Command, R extends AbstractBaseRecord> boolean scan( Physical
LogEntry entry = logEntryCursor.get(); LogEntry entry = logEntryCursor.get();
if ( entry instanceof LogEntryCommand ) if ( entry instanceof LogEntryCommand )
{ {
StorageCommand command = ((LogEntryCommand) entry).getXaCommand(); StorageCommand command = ((LogEntryCommand) entry).getCommand();
if ( check.commandClass().isInstance( command ) ) if ( check.commandClass().isInstance( command ) )
{ {
long logVersion = logEntryCursor.getCurrentLogVersion(); long logVersion = logEntryCursor.getCurrentLogVersion();
Expand Down
Expand Up @@ -232,7 +232,7 @@ private static void assertTransaction( LogEntry[] transactionEntries, long expec
assertTrue( Arrays.toString( transactionEntries ), transactionEntries[0] instanceof LogEntryStart ); assertTrue( Arrays.toString( transactionEntries ), transactionEntries[0] instanceof LogEntryStart );
assertTrue( transactionEntries[1] instanceof LogEntryCommand ); assertTrue( transactionEntries[1] instanceof LogEntryCommand );
LogEntryCommand command = transactionEntries[1].as(); LogEntryCommand command = transactionEntries[1].as();
assertEquals( expectedId, ((Command.NodeCommand)command.getXaCommand()).getKey() ); assertEquals( expectedId, ((Command.NodeCommand)command.getCommand()).getKey() );
assertTrue( transactionEntries[2] instanceof LogEntryCommit ); assertTrue( transactionEntries[2] instanceof LogEntryCommit );
LogEntryCommit commit = transactionEntries[2].as(); LogEntryCommit commit = transactionEntries[2].as();
assertEquals( expectedId, commit.getTxId() ); assertEquals( expectedId, commit.getTxId() );
Expand Down

0 comments on commit 444f868

Please sign in to comment.