Skip to content

Commit

Permalink
Remove support for reading 1.9 tx logs
Browse files Browse the repository at this point in the history
Since we don't support migration from 1.9 to 3.0, there is no need to
keep around code to read old 1.9 tx logs.
  • Loading branch information
davidegrohmann committed Mar 24, 2016
1 parent c71151b commit 3dc10d9
Show file tree
Hide file tree
Showing 41 changed files with 110 additions and 879 deletions.
Expand Up @@ -24,14 +24,12 @@

import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageCommandReaderFactory;
import org.neo4j.kernel.impl.store.MetaDataStore;
import org.neo4j.kernel.impl.store.NeoStores;
import org.neo4j.kernel.impl.transaction.log.LogPosition;
import org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles;
import org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryVersion;
import org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader;
import org.neo4j.kernel.recovery.LatestCheckPointFinder;
import org.neo4j.kernel.recovery.PositionToRecoverFrom;
Expand Down Expand Up @@ -65,9 +63,7 @@ public boolean isRecoveryRequiredAt( File dataDir ) throws IOException
long logVersion = MetaDataStore.getRecord( pageCache, neoStore, MetaDataStore.Position.LOG_VERSION );
PhysicalLogFiles logFiles = new PhysicalLogFiles( dataDir, fs );

LogEntryReader<ReadableClosablePositionAwareChannel> reader =
new VersionAwareLogEntryReader<>( LogEntryVersion.CURRENT.byteCode(),
new RecordStorageCommandReaderFactory() );
LogEntryReader<ReadableClosablePositionAwareChannel> reader = new VersionAwareLogEntryReader<>();

LatestCheckPointFinder finder = new LatestCheckPointFinder( logFiles, fs, reader );
return new PositionToRecoverFrom( finder ).apply( logVersion ) != LogPosition.UNSPECIFIED;
Expand Down
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.kernel.impl.storageengine.impl.recordstorage;

import org.neo4j.kernel.impl.transaction.command.PhysicalLogCommandReaderV1_9;
import org.neo4j.kernel.impl.transaction.command.PhysicalLogCommandReaderV2_0;
import org.neo4j.kernel.impl.transaction.command.PhysicalLogCommandReaderV2_1;
import org.neo4j.kernel.impl.transaction.command.PhysicalLogCommandReaderV2_2;
Expand All @@ -34,22 +33,17 @@
public class RecordStorageCommandReaderFactory implements CommandReaderFactory
{
// All supported readers. Key/index is LogEntryVersion byte code.
private final CommandReader[] readersNegative, readersNeutral;
private final CommandReader[] readers;

public RecordStorageCommandReaderFactory()
{
// These versions have version=0, but are distinguished by the log header format version
readersNeutral = new CommandReader[10]; // pessimistic size
readersNeutral[LogEntryVersion.V1_9.logHeaderFormatVersion()] = new PhysicalLogCommandReaderV1_9();
readersNeutral[LogEntryVersion.V2_0.logHeaderFormatVersion()] = new PhysicalLogCommandReaderV2_0();

// These versions have each their own version and so are directly distinguishable
readersNegative = new CommandReader[10]; // pessimistic size
readersNegative[-LogEntryVersion.V2_1.byteCode()] = new PhysicalLogCommandReaderV2_1();
readersNegative[-LogEntryVersion.V2_2.byteCode()] = new PhysicalLogCommandReaderV2_2();
readersNegative[-LogEntryVersion.V2_2_4.byteCode()] = new PhysicalLogCommandReaderV2_2_4();
readersNegative[-LogEntryVersion.V2_3.byteCode()] = new PhysicalLogCommandReaderV2_2_4();
readersNegative[-LogEntryVersion.V3_0.byteCode()] = new PhysicalLogCommandReaderV3_0();
readers = new CommandReader[10]; // pessimistic size
readers[-LogEntryVersion.V2_0.byteCode()] = new PhysicalLogCommandReaderV2_0();
readers[-LogEntryVersion.V2_1.byteCode()] = new PhysicalLogCommandReaderV2_1();
readers[-LogEntryVersion.V2_2.byteCode()] = new PhysicalLogCommandReaderV2_2();
readers[-LogEntryVersion.V2_2_4.byteCode()] = new PhysicalLogCommandReaderV2_2_4();
readers[-LogEntryVersion.V2_3.byteCode()] = new PhysicalLogCommandReaderV2_2_4();
readers[-LogEntryVersion.V3_0.byteCode()] = new PhysicalLogCommandReaderV3_0();

// A little extra safety check so that we got 'em all
LogEntryVersion[] versions = LogEntryVersion.values();
Expand All @@ -63,25 +57,12 @@ public RecordStorageCommandReaderFactory()
}

@Override
public CommandReader byVersion( byte version, byte legacyHeaderVersion )
public CommandReader byVersion( byte version )
{
CommandReader[] readers = null;
byte key = 0;
if ( version == 0 )
{
readers = readersNeutral;
key = legacyHeaderVersion;
}
else if ( version < 0 )
{
readers = readersNegative;
key = (byte) abs( version );
}

if ( readers == null || key >= readers.length )
byte key = (byte) abs( version );
if ( key >= readers.length )
{
throw new IllegalArgumentException( "Unsupported version:" + version +
" headerVersion:" + legacyHeaderVersion );
throw new IllegalArgumentException( "Unsupported version:" + version );
}
return readers[key];
}
Expand Down
Expand Up @@ -23,7 +23,6 @@
import java.io.IOException;

import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageCommandReaderFactory;
import org.neo4j.kernel.impl.store.MetaDataStore;
import org.neo4j.kernel.impl.store.format.Capability;
import org.neo4j.kernel.impl.store.format.InternalRecordFormatSelector;
Expand Down Expand Up @@ -132,8 +131,7 @@ private Result checkCleanShutDownByCheckPoint( File storeDirectory )
{
// check version
PhysicalLogFiles logFiles = new PhysicalLogFiles( storeDirectory, fs );
LogEntryReader<ReadableClosablePositionAwareChannel> logEntryReader =
new VersionAwareLogEntryReader<>( new RecordStorageCommandReaderFactory() );
LogEntryReader<ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader<>();
LatestCheckPointFinder latestCheckPointFinder =
new LatestCheckPointFinder( logFiles, fs, logEntryReader );
try
Expand Down
Expand Up @@ -28,7 +28,6 @@
import org.neo4j.helpers.collection.Pair;
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.fs.StoreChannel;
import org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageCommandReaderFactory;
import org.neo4j.kernel.impl.transaction.log.PhysicalLogVersionedStoreChannel;
import org.neo4j.kernel.impl.transaction.log.ReadAheadLogChannel;
import org.neo4j.kernel.impl.transaction.log.ReadableLogChannel;
Expand Down Expand Up @@ -57,8 +56,7 @@ class LegacyLogEntryReader

LegacyLogEntryReader( FileSystemAbstraction fs )
{
this( fs, from -> new VersionAwareLogEntryReader<>( from.logFormatVersion,
new RecordStorageCommandReaderFactory() ) );
this( fs, from -> new VersionAwareLogEntryReader<>() );
}

public Pair<LogHeader, IOCursor<LogEntry>> openReadableChannel( File logFile ) throws IOException
Expand Down

0 comments on commit 3dc10d9

Please sign in to comment.