Package org.apache.accumulo.server.fs
Class VolumeManagerImpl
java.lang.Object
org.apache.accumulo.server.fs.VolumeManagerImpl
- All Implemented Interfaces:
AutoCloseable
,VolumeManager
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.accumulo.server.fs.VolumeManager
VolumeManager.FileType
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
VolumeManagerImpl
(Map<String, Volume> volumes, AccumuloConfiguration conf, org.apache.hadoop.conf.Configuration hadoopConf) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bulkRename
(Map<org.apache.hadoop.fs.Path, org.apache.hadoop.fs.Path> oldToNewPathMap, int poolSize, String poolName, String transactionId) Rename lots of files at once in a thread pool and return once all the threads have completed.boolean
canSyncAndFlush
(org.apache.hadoop.fs.Path path) choosable
(VolumeChooserEnvironment env, Set<String> options) choose
(VolumeChooserEnvironment env, Set<String> options) void
close()
org.apache.hadoop.fs.FSDataOutputStream
create
(org.apache.hadoop.fs.Path path) org.apache.hadoop.fs.FSDataOutputStream
create
(org.apache.hadoop.fs.Path path, boolean overwrite, int bufferSize, short replication, long blockSize) boolean
createNewFile
(org.apache.hadoop.fs.Path path) org.apache.hadoop.fs.FSDataOutputStream
createSyncable
(org.apache.hadoop.fs.Path logPath, int bufferSize, short replication, long blockSize) boolean
delete
(org.apache.hadoop.fs.Path path) boolean
deleteRecursively
(org.apache.hadoop.fs.Path path) protected void
boolean
exists
(org.apache.hadoop.fs.Path path) findVolumeOverridesMissingVolume
(AccumuloConfiguration conf, Set<String> definedVolumes) static VolumeManager
get
(AccumuloConfiguration conf, org.apache.hadoop.conf.Configuration hadoopConf) short
getDefaultReplication
(org.apache.hadoop.fs.Path path) org.apache.hadoop.fs.FileStatus
getFileStatus
(org.apache.hadoop.fs.Path path) org.apache.hadoop.fs.FileSystem
getFileSystemByPath
(org.apache.hadoop.fs.Path path) static VolumeManager
getLocalForTesting
(String localBasePath) protected static org.apache.hadoop.conf.Configuration
getVolumeManagerConfiguration
(AccumuloConfiguration conf, org.apache.hadoop.conf.Configuration hadoopConf, String filesystemURI) The Hadoop Configuration object does not currently allow for duplicate properties to be set in a single Configuration for different FileSystem URIs.Fetch the configured instance Volumesorg.apache.hadoop.fs.FileStatus[]
globStatus
(org.apache.hadoop.fs.Path pathPattern) boolean
isReady()
org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus>
listFiles
(org.apache.hadoop.fs.Path path, boolean recursive) org.apache.hadoop.fs.FileStatus[]
listStatus
(org.apache.hadoop.fs.Path path) org.apache.hadoop.fs.Path
matchingFileSystem
(org.apache.hadoop.fs.Path source, Set<String> options) boolean
mkdirs
(org.apache.hadoop.fs.Path path) boolean
mkdirs
(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.permission.FsPermission permission) boolean
moveToTrash
(org.apache.hadoop.fs.Path path) org.apache.hadoop.fs.FSDataInputStream
open
(org.apache.hadoop.fs.Path path) org.apache.hadoop.fs.FSDataOutputStream
overwrite
(org.apache.hadoop.fs.Path path) boolean
rename
(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.Path newPath) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.accumulo.server.fs.VolumeManager
getFirst
-
Constructor Details
-
VolumeManagerImpl
protected VolumeManagerImpl(Map<String, Volume> volumes, AccumuloConfiguration conf, org.apache.hadoop.conf.Configuration hadoopConf)
-
-
Method Details
-
getLocalForTesting
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceVolumeManager
- Throws:
IOException
-
create
public org.apache.hadoop.fs.FSDataOutputStream create(org.apache.hadoop.fs.Path path) throws IOException - Specified by:
create
in interfaceVolumeManager
- Throws:
IOException
-
overwrite
public org.apache.hadoop.fs.FSDataOutputStream overwrite(org.apache.hadoop.fs.Path path) throws IOException - Specified by:
overwrite
in interfaceVolumeManager
- Throws:
IOException
-
create
public org.apache.hadoop.fs.FSDataOutputStream create(org.apache.hadoop.fs.Path path, boolean overwrite, int bufferSize, short replication, long blockSize) throws IOException - Specified by:
create
in interfaceVolumeManager
- Throws:
IOException
-
createNewFile
- Specified by:
createNewFile
in interfaceVolumeManager
- Throws:
IOException
-
createSyncable
public org.apache.hadoop.fs.FSDataOutputStream createSyncable(org.apache.hadoop.fs.Path logPath, int bufferSize, short replication, long blockSize) throws IOException - Specified by:
createSyncable
in interfaceVolumeManager
- Throws:
IOException
-
delete
- Specified by:
delete
in interfaceVolumeManager
- Throws:
IOException
-
deleteRecursively
- Specified by:
deleteRecursively
in interfaceVolumeManager
- Throws:
IOException
-
ensureSyncIsEnabled
protected void ensureSyncIsEnabled() -
exists
- Specified by:
exists
in interfaceVolumeManager
- Throws:
IOException
-
getFileStatus
public org.apache.hadoop.fs.FileStatus getFileStatus(org.apache.hadoop.fs.Path path) throws IOException - Specified by:
getFileStatus
in interfaceVolumeManager
- Throws:
IOException
-
getFileSystemByPath
public org.apache.hadoop.fs.FileSystem getFileSystemByPath(org.apache.hadoop.fs.Path path) - Specified by:
getFileSystemByPath
in interfaceVolumeManager
-
listFiles
public org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus> listFiles(org.apache.hadoop.fs.Path path, boolean recursive) throws IOException - Specified by:
listFiles
in interfaceVolumeManager
- Throws:
IOException
-
listStatus
public org.apache.hadoop.fs.FileStatus[] listStatus(org.apache.hadoop.fs.Path path) throws IOException - Specified by:
listStatus
in interfaceVolumeManager
- Throws:
IOException
-
mkdirs
- Specified by:
mkdirs
in interfaceVolumeManager
- Throws:
IOException
-
mkdirs
public boolean mkdirs(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.permission.FsPermission permission) throws IOException - Specified by:
mkdirs
in interfaceVolumeManager
- Throws:
IOException
-
open
public org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.Path path) throws IOException - Specified by:
open
in interfaceVolumeManager
- Throws:
IOException
-
rename
public boolean rename(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.Path newPath) throws IOException - Specified by:
rename
in interfaceVolumeManager
- Throws:
IOException
-
bulkRename
public void bulkRename(Map<org.apache.hadoop.fs.Path, org.apache.hadoop.fs.Path> oldToNewPathMap, int poolSize, String poolName, String transactionId) throws IOExceptionDescription copied from interface:VolumeManager
Rename lots of files at once in a thread pool and return once all the threads have completed. This operation should be idempotent to allow calling multiple times in the case of a partial completion.- Specified by:
bulkRename
in interfaceVolumeManager
- Throws:
IOException
-
moveToTrash
- Specified by:
moveToTrash
in interfaceVolumeManager
- Throws:
IOException
-
getDefaultReplication
public short getDefaultReplication(org.apache.hadoop.fs.Path path) - Specified by:
getDefaultReplication
in interfaceVolumeManager
-
getVolumeManagerConfiguration
protected static org.apache.hadoop.conf.Configuration getVolumeManagerConfiguration(AccumuloConfiguration conf, org.apache.hadoop.conf.Configuration hadoopConf, String filesystemURI) The Hadoop Configuration object does not currently allow for duplicate properties to be set in a single Configuration for different FileSystem URIs. Here we will look for properties in the Accumulo configuration of the form:instance.volume.config.<volume-uri>.<hdfs-property>
We will use these properties to return a new Configuration object that can be used with the FileSystem URI to override properties in the original Configuration. If these properties are not set for a volume, then the original Configuration is returned. If they are set, a new Configuration is created with the overridden properties set. In either case, the returned Configuration is cached, to avoid unnecessary recomputation. This works because these override properties are instance properties and cannot change while the system is running.- Parameters:
conf
- AccumuloConfiguration objecthadoopConf
- Hadoop Configuration objectfilesystemURI
- Volume Filesystem URI- Returns:
- Hadoop Configuration with custom overrides for this FileSystem
-
findVolumeOverridesMissingVolume
-
get
public static VolumeManager get(AccumuloConfiguration conf, org.apache.hadoop.conf.Configuration hadoopConf) throws IOException - Throws:
IOException
-
isReady
- Specified by:
isReady
in interfaceVolumeManager
- Throws:
IOException
-
globStatus
public org.apache.hadoop.fs.FileStatus[] globStatus(org.apache.hadoop.fs.Path pathPattern) throws IOException - Specified by:
globStatus
in interfaceVolumeManager
- Throws:
IOException
-
matchingFileSystem
public org.apache.hadoop.fs.Path matchingFileSystem(org.apache.hadoop.fs.Path source, Set<String> options) - Specified by:
matchingFileSystem
in interfaceVolumeManager
-
choose
- Specified by:
choose
in interfaceVolumeManager
-
choosable
- Specified by:
choosable
in interfaceVolumeManager
-
canSyncAndFlush
public boolean canSyncAndFlush(org.apache.hadoop.fs.Path path) - Specified by:
canSyncAndFlush
in interfaceVolumeManager
-
getVolumes
Description copied from interface:VolumeManager
Fetch the configured instance Volumes- Specified by:
getVolumes
in interfaceVolumeManager
-