Skip to content

Commit

Permalink
Remove custom block device support.
Browse files Browse the repository at this point in the history
Remove page cache file system.
Remove ability to stream files over page cache.
Always use default file system for all copy/transfer operations.
Remove page file read and write channel.
  • Loading branch information
MishaDemianenko committed May 10, 2018
1 parent 33f7e2c commit 5ca441a
Show file tree
Hide file tree
Showing 88 changed files with 213 additions and 1,411 deletions.
Expand Up @@ -244,7 +244,7 @@ fileSystem, config, new SimpleLogService( logProvider, logProvider ), pageCache,
IndexProviderMap indexes = loadIndexProviders( extensions );

LabelScanStore labelScanStore =
new NativeLabelScanStore( pageCache, storeDir, FullStoreChangeStream.EMPTY, true, monitors,
new NativeLabelScanStore( pageCache, storeDir, fileSystem, FullStoreChangeStream.EMPTY, true, monitors,
RecoveryCleanupWorkCollector.IGNORE );
life.add( labelScanStore );

Expand Down
Expand Up @@ -39,13 +39,13 @@
import org.neo4j.graphdb.factory.GraphDatabaseBuilder;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector;
import org.neo4j.internal.kernel.api.exceptions.TransactionFailureException;
import org.neo4j.io.fs.DefaultFileSystemAbstraction;
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.io.pagecache.tracing.cursor.context.EmptyVersionContextSupplier;
import org.neo4j.kernel.api.StatementConstants;
import org.neo4j.kernel.api.direct.DirectStoreAccess;
import org.neo4j.internal.kernel.api.exceptions.TransactionFailureException;
import org.neo4j.kernel.api.labelscan.LabelScanStore;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.extension.KernelExtensions;
Expand Down Expand Up @@ -197,7 +197,7 @@ public DirectStoreAccess directStoreAccess()
private LabelScanStore startLabelScanStore( PageCache pageCache, IndexStoreView indexStoreView, Monitors monitors )
{
NativeLabelScanStore labelScanStore =
new NativeLabelScanStore( pageCache, directory, new FullLabelStream( indexStoreView ), false, monitors,
new NativeLabelScanStore( pageCache, directory, fileSystem, new FullLabelStream( indexStoreView ), false, monitors,
RecoveryCleanupWorkCollector.IMMEDIATE );
try
{
Expand Down
19 changes: 0 additions & 19 deletions community/io/src/main/java/org/neo4j/io/pagecache/PageCache.java
Expand Up @@ -26,8 +26,6 @@
import java.util.List;
import java.util.Optional;

import org.neo4j.io.fs.FileSystemAbstraction;

/**
* A page caching mechanism that allows caching multiple files and accessing their data
* in pages via a re-usable cursor.
Expand Down Expand Up @@ -134,26 +132,9 @@ public interface PageCache extends AutoCloseable
*/
long maxCachedPages();

/**
* Get the {@link FileSystemAbstraction} that represents the filesystem where the paged files reside.
*
* @return the filesystem that the page cache is using.
*/
FileSystemAbstraction getCachedFileSystem();

/**
* Report any thread-local events to the global page cache tracer, as if acquiring a thread-specific page cursor
* tracer, and reporting the events collected within it.
*/
void reportEvents();

/**
* Check if the backing {@link FileSystemAbstraction file system} supports regular file operations or not.
* <p>
* E.g. the file system for block device will not work with generic open and read/write calls and all operations
* needs to be done through the page cache.
*
* @return {@code true} if the backing file system supports regular file operations.
*/
boolean fileSystemSupportsFileOperations();
}
Expand Up @@ -45,11 +45,6 @@ public interface PageSwapperFactory
*/
void open( FileSystemAbstraction fs, Configuration config );

/**
* Get the {@link FileSystemAbstraction} that represents the underlying storage for the page swapper.
*/
FileSystemAbstraction getFileSystemAbstraction();

/**
* Get the name of this PageSwapperFactory implementation, for configuration purpose.
*/
Expand Down
32 changes: 0 additions & 32 deletions community/io/src/main/java/org/neo4j/io/pagecache/PagedFile.java
Expand Up @@ -21,9 +21,6 @@

import java.io.File;
import java.io.IOException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.nio.file.OpenOption;

/**
* The representation of a file that has been mapped into the associated page cache.
Expand Down Expand Up @@ -191,33 +188,4 @@ public interface PagedFile extends AutoCloseable
@Override
void close() throws IOException;

/**
* Open a {@link ReadableByteChannel} view of this PagedFile.
* <p>
* The channel will read the file sequentially from the beginning till the end.
* Seeking is not supported.
* <p>
* The channel is not thread-safe.
*
* @return A channel for reading the paged file.
*/
ReadableByteChannel openReadableByteChannel() throws IOException;

/**
* Open a {@link WritableByteChannel} view of this PagedFile.
* <p>
* The channel will write to the file sequentially from the beginning of the file, overwriting whatever is there
* already. If the amount of new data is less than the amount of existing data, then the old data will still be
* present at the far end of the file. Thus, this function works neither like opening a file for writing, nor like
* appending to a file.
* <p>
* If this is undesired, then the file can be mapped with {@link java.nio.file.StandardOpenOption#TRUNCATE_EXISTING}
* to remove the existing data before writing to the file.
* <p>
* The channel is not thread-safe.
*
* @return A channel for writing to the paged file.
* @see PageCache#map(File, int, OpenOption...)
*/
WritableByteChannel openWritableByteChannel() throws IOException;
}

This file was deleted.

This file was deleted.

Expand Up @@ -44,12 +44,6 @@ public void open( FileSystemAbstraction fs, Configuration config )
this.fs = fs;
}

@Override
public FileSystemAbstraction getFileSystemAbstraction()
{
return fs;
}

@Override
public PageSwapper createPageSwapper(
File file,
Expand Down
Expand Up @@ -35,8 +35,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.LockSupport;

import org.neo4j.io.fs.DefaultFileSystemAbstraction;
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.mem.MemoryAllocator;
import org.neo4j.io.pagecache.IOLimiter;
import org.neo4j.io.pagecache.PageCache;
Expand Down Expand Up @@ -700,25 +698,12 @@ public long maxCachedPages()
return pages.getPageCount();
}

@Override
public FileSystemAbstraction getCachedFileSystem()
{
return swapperFactory.getFileSystemAbstraction();
}

@Override
public void reportEvents()
{
pageCursorTracerSupplier.get().reportEvents();
}

@Override
public boolean fileSystemSupportsFileOperations()
{
// Default filesystem supports direct file access.
return getCachedFileSystem() instanceof DefaultFileSystemAbstraction;
}

int getPageCacheId()
{
return pageCacheId;
Expand Down
Expand Up @@ -23,8 +23,6 @@
import java.io.Flushable;
import java.io.IOException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.util.Arrays;

import org.neo4j.io.pagecache.IOLimiter;
Expand All @@ -34,8 +32,6 @@
import org.neo4j.io.pagecache.PageSwapperFactory;
import org.neo4j.io.pagecache.PagedFile;
import org.neo4j.io.pagecache.impl.FileIsNotMappedException;
import org.neo4j.io.pagecache.impl.PagedReadableByteChannel;
import org.neo4j.io.pagecache.impl.PagedWritableByteChannel;
import org.neo4j.io.pagecache.tracing.FlushEvent;
import org.neo4j.io.pagecache.tracing.FlushEventOpportunity;
import org.neo4j.io.pagecache.tracing.MajorFlushEvent;
Expand Down Expand Up @@ -228,18 +224,6 @@ public void close()
pageCache.unmap( this );
}

@Override
public ReadableByteChannel openReadableByteChannel() throws IOException
{
return new PagedReadableByteChannel( this );
}

@Override
public WritableByteChannel openWritableByteChannel() throws IOException
{
return new PagedWritableByteChannel( this );
}

void closeSwapper() throws IOException
{
// We don't set closeStackTrace in close(), because the reference count may keep the file open.
Expand Down

0 comments on commit 5ca441a

Please sign in to comment.