HDFS-8712. Remove 'public' and 'abstract' modifiers in FsVolumeSpi and FsDatasetSpi (Contributed by Lei (Eddy) Xu)

(cherry picked from commit bd4e10900c)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java
	hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsVolumeSpi.java
This commit is contained in:
Vinayakumar B 2015-07-08 16:34:54 +05:30
parent 01e12b7d69
commit 6fe2e7c3f3
3 changed files with 103 additions and 100 deletions

View File

@ -368,6 +368,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8620. Clean up the checkstyle warinings about ClientProtocol. HDFS-8620. Clean up the checkstyle warinings about ClientProtocol.
(Takanobu Asanuma via wheat9) (Takanobu Asanuma via wheat9)
HDFS-8712. Remove 'public' and 'abstracta modifiers in FsVolumeSpi and
FsDatasetSpi (Lei (Eddy) Xu via vinayakumarb)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -72,7 +72,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
/** /**
* A factory for creating {@link FsDatasetSpi} objects. * A factory for creating {@link FsDatasetSpi} objects.
*/ */
public static abstract class Factory<D extends FsDatasetSpi<?>> { abstract class Factory<D extends FsDatasetSpi<?>> {
/** @return the configured factory. */ /** @return the configured factory. */
public static Factory<?> getFactory(Configuration conf) { public static Factory<?> getFactory(Configuration conf) {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ -182,7 +182,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* The caller must release the reference of each volume by calling * The caller must release the reference of each volume by calling
* {@link FsVolumeReferences#close()}. * {@link FsVolumeReferences#close()}.
*/ */
public FsVolumeReferences getFsVolumeReferences(); FsVolumeReferences getFsVolumeReferences();
/** /**
* Add a new volume to the FsDataset.<p/> * Add a new volume to the FsDataset.<p/>
@ -193,7 +193,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param location The storage location for the new volume. * @param location The storage location for the new volume.
* @param nsInfos Namespace information for the new volume. * @param nsInfos Namespace information for the new volume.
*/ */
public void addVolume( void addVolume(
final StorageLocation location, final StorageLocation location,
final List<NamespaceInfo> nsInfos) throws IOException; final List<NamespaceInfo> nsInfos) throws IOException;
@ -207,20 +207,20 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param clearFailure set true to clear the failure information about the * @param clearFailure set true to clear the failure information about the
* volumes. * volumes.
*/ */
public void removeVolumes(Set<File> volumes, boolean clearFailure); void removeVolumes(Set<File> volumes, boolean clearFailure);
/** @return a storage with the given storage ID */ /** @return a storage with the given storage ID */
public DatanodeStorage getStorage(final String storageUuid); DatanodeStorage getStorage(final String storageUuid);
/** @return one or more storage reports for attached volumes. */ /** @return one or more storage reports for attached volumes. */
public StorageReport[] getStorageReports(String bpid) StorageReport[] getStorageReports(String bpid)
throws IOException; throws IOException;
/** @return the volume that contains a replica of the block. */ /** @return the volume that contains a replica of the block. */
public V getVolume(ExtendedBlock b); V getVolume(ExtendedBlock b);
/** @return a volume information map (name => info). */ /** @return a volume information map (name => info). */
public Map<String, Object> getVolumeInfoMap(); Map<String, Object> getVolumeInfoMap();
/** /**
* Returns info about volume failures. * Returns info about volume failures.
@ -230,17 +230,17 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
VolumeFailureSummary getVolumeFailureSummary(); VolumeFailureSummary getVolumeFailureSummary();
/** @return a list of finalized blocks for the given block pool. */ /** @return a list of finalized blocks for the given block pool. */
public List<FinalizedReplica> getFinalizedBlocks(String bpid); List<FinalizedReplica> getFinalizedBlocks(String bpid);
/** @return a list of finalized blocks for the given block pool. */ /** @return a list of finalized blocks for the given block pool. */
public List<FinalizedReplica> getFinalizedBlocksOnPersistentStorage(String bpid); List<FinalizedReplica> getFinalizedBlocksOnPersistentStorage(String bpid);
/** /**
* Check whether the in-memory block record matches the block on the disk, * Check whether the in-memory block record matches the block on the disk,
* and, in case that they are not matched, update the record or mark it * and, in case that they are not matched, update the record or mark it
* as corrupted. * as corrupted.
*/ */
public void checkAndUpdate(String bpid, long blockId, File diskFile, void checkAndUpdate(String bpid, long blockId, File diskFile,
File diskMetaFile, FsVolumeSpi vol) throws IOException; File diskMetaFile, FsVolumeSpi vol) throws IOException;
/** /**
@ -249,15 +249,15 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* otherwise, return null. * otherwise, return null.
* @throws IOException * @throws IOException
*/ */
public LengthInputStream getMetaDataInputStream(ExtendedBlock b LengthInputStream getMetaDataInputStream(ExtendedBlock b
) throws IOException; ) throws IOException;
/** /**
* Returns the specified block's on-disk length (excluding metadata) * Returns the specified block's on-disk length (excluding metadata).
* @return the specified block's on-disk length (excluding metadta) * @return the specified block's on-disk length (excluding metadta)
* @throws IOException on error * @throws IOException on error
*/ */
public long getLength(ExtendedBlock b) throws IOException; long getLength(ExtendedBlock b) throws IOException;
/** /**
* Get reference to the replica meta info in the replicasMap. * Get reference to the replica meta info in the replicasMap.
@ -265,47 +265,48 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return replica from the replicas map * @return replica from the replicas map
*/ */
@Deprecated @Deprecated
public Replica getReplica(String bpid, long blockId); Replica getReplica(String bpid, long blockId);
/** /**
* @return replica meta information * @return replica meta information
*/ */
public String getReplicaString(String bpid, long blockId); String getReplicaString(String bpid, long blockId);
/** /**
* @return the generation stamp stored with the block. * @return the generation stamp stored with the block.
*/ */
public Block getStoredBlock(String bpid, long blkid) throws IOException; Block getStoredBlock(String bpid, long blkid) throws IOException;
/** /**
* Returns an input stream at specified offset of the specified block * Returns an input stream at specified offset of the specified block.
* @param b block * @param b block
* @param seekOffset offset with in the block to seek to * @param seekOffset offset with in the block to seek to
* @return an input stream to read the contents of the specified block, * @return an input stream to read the contents of the specified block,
* starting at the offset * starting at the offset
* @throws IOException * @throws IOException
*/ */
public InputStream getBlockInputStream(ExtendedBlock b, long seekOffset) InputStream getBlockInputStream(ExtendedBlock b, long seekOffset)
throws IOException; throws IOException;
/** /**
* Returns an input stream at specified offset of the specified block * Returns an input stream at specified offset of the specified block.
* The block is still in the tmp directory and is not finalized * The block is still in the tmp directory and is not finalized
* @return an input stream to read the contents of the specified block, * @return an input stream to read the contents of the specified block,
* starting at the offset * starting at the offset
* @throws IOException * @throws IOException
*/ */
public ReplicaInputStreams getTmpInputStreams(ExtendedBlock b, long blkoff, ReplicaInputStreams getTmpInputStreams(ExtendedBlock b, long blkoff,
long ckoff) throws IOException; long ckoff) throws IOException;
/** /**
* Creates a temporary replica and returns the meta information of the replica * Creates a temporary replica and returns the meta information of the replica
* .
* *
* @param b block * @param b block
* @return the meta info of the replica which is being written to * @return the meta info of the replica which is being written to
* @throws IOException if an error occurs * @throws IOException if an error occurs
*/ */
public ReplicaHandler createTemporary(StorageType storageType, ReplicaHandler createTemporary(StorageType storageType,
ExtendedBlock b) throws IOException; ExtendedBlock b) throws IOException;
/** /**
@ -315,11 +316,11 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return the meta info of the replica which is being written to * @return the meta info of the replica which is being written to
* @throws IOException if an error occurs * @throws IOException if an error occurs
*/ */
public ReplicaHandler createRbw(StorageType storageType, ReplicaHandler createRbw(StorageType storageType,
ExtendedBlock b, boolean allowLazyPersist) throws IOException; ExtendedBlock b, boolean allowLazyPersist) throws IOException;
/** /**
* Recovers a RBW replica and returns the meta info of the replica * Recovers a RBW replica and returns the meta info of the replica.
* *
* @param b block * @param b block
* @param newGS the new generation stamp for the replica * @param newGS the new generation stamp for the replica
@ -328,7 +329,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return the meta info of the replica which is being written to * @return the meta info of the replica which is being written to
* @throws IOException if an error occurs * @throws IOException if an error occurs
*/ */
public ReplicaHandler recoverRbw(ExtendedBlock b, ReplicaHandler recoverRbw(ExtendedBlock b,
long newGS, long minBytesRcvd, long maxBytesRcvd) throws IOException; long newGS, long minBytesRcvd, long maxBytesRcvd) throws IOException;
/** /**
@ -336,11 +337,11 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param temporary the temporary replica being converted * @param temporary the temporary replica being converted
* @return the result RBW * @return the result RBW
*/ */
public ReplicaInPipelineInterface convertTemporaryToRbw( ReplicaInPipelineInterface convertTemporaryToRbw(
ExtendedBlock temporary) throws IOException; ExtendedBlock temporary) throws IOException;
/** /**
* Append to a finalized replica and returns the meta info of the replica * Append to a finalized replica and returns the meta info of the replica.
* *
* @param b block * @param b block
* @param newGS the new generation stamp for the replica * @param newGS the new generation stamp for the replica
@ -348,12 +349,12 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return the meata info of the replica which is being written to * @return the meata info of the replica which is being written to
* @throws IOException * @throws IOException
*/ */
public ReplicaHandler append(ExtendedBlock b, long newGS, ReplicaHandler append(ExtendedBlock b, long newGS,
long expectedBlockLen) throws IOException; long expectedBlockLen) throws IOException;
/** /**
* Recover a failed append to a finalized replica * Recover a failed append to a finalized replica and returns the meta
* and returns the meta info of the replica * info of the replica.
* *
* @param b block * @param b block
* @param newGS the new generation stamp for the replica * @param newGS the new generation stamp for the replica
@ -361,11 +362,11 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return the meta info of the replica which is being written to * @return the meta info of the replica which is being written to
* @throws IOException * @throws IOException
*/ */
public ReplicaHandler recoverAppend( ReplicaHandler recoverAppend(
ExtendedBlock b, long newGS, long expectedBlockLen) throws IOException; ExtendedBlock b, long newGS, long expectedBlockLen) throws IOException;
/** /**
* Recover a failed pipeline close * Recover a failed pipeline close.
* It bumps the replica's generation stamp and finalize it if RBW replica * It bumps the replica's generation stamp and finalize it if RBW replica
* *
* @param b block * @param b block
@ -374,7 +375,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return the storage uuid of the replica. * @return the storage uuid of the replica.
* @throws IOException * @throws IOException
*/ */
public String recoverClose(ExtendedBlock b, long newGS, long expectedBlockLen String recoverClose(ExtendedBlock b, long newGS, long expectedBlockLen
) throws IOException; ) throws IOException;
/** /**
@ -386,21 +387,21 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* block is been finalized. For instance, the block resides on an HDFS volume * block is been finalized. For instance, the block resides on an HDFS volume
* that has been removed. * that has been removed.
*/ */
public void finalizeBlock(ExtendedBlock b) throws IOException; void finalizeBlock(ExtendedBlock b) throws IOException;
/** /**
* Unfinalizes the block previously opened for writing using writeToBlock. * Unfinalizes the block previously opened for writing using writeToBlock.
* The temporary file associated with this block is deleted. * The temporary file associated with this block is deleted.
* @throws IOException * @throws IOException
*/ */
public void unfinalizeBlock(ExtendedBlock b) throws IOException; void unfinalizeBlock(ExtendedBlock b) throws IOException;
/** /**
* Returns one block report per volume. * Returns one block report per volume.
* @param bpid Block Pool Id * @param bpid Block Pool Id
* @return - a map of DatanodeStorage to block report for the volume. * @return - a map of DatanodeStorage to block report for the volume.
*/ */
public Map<DatanodeStorage, BlockListAsLongs> getBlockReports(String bpid); Map<DatanodeStorage, BlockListAsLongs> getBlockReports(String bpid);
/** /**
* Returns the cache report - the full list of cached block IDs of a * Returns the cache report - the full list of cached block IDs of a
@ -408,10 +409,10 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param bpid Block Pool Id * @param bpid Block Pool Id
* @return the cache report - the full list of cached block IDs. * @return the cache report - the full list of cached block IDs.
*/ */
public List<Long> getCacheReport(String bpid); List<Long> getCacheReport(String bpid);
/** Does the dataset contain the block? */ /** Does the dataset contain the block? */
public boolean contains(ExtendedBlock block); boolean contains(ExtendedBlock block);
/** /**
* Check if a block is valid. * Check if a block is valid.
@ -431,7 +432,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* *
* @throws IOException May be thrown from the methods called. * @throws IOException May be thrown from the methods called.
*/ */
public void checkBlock(ExtendedBlock b, long minLength, ReplicaState state) void checkBlock(ExtendedBlock b, long minLength, ReplicaState state)
throws ReplicaNotFoundException, UnexpectedReplicaStateException, throws ReplicaNotFoundException, UnexpectedReplicaStateException,
FileNotFoundException, EOFException, IOException; FileNotFoundException, EOFException, IOException;
@ -440,13 +441,13 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* Is the block valid? * Is the block valid?
* @return - true if the specified block is valid * @return - true if the specified block is valid
*/ */
public boolean isValidBlock(ExtendedBlock b); boolean isValidBlock(ExtendedBlock b);
/** /**
* Is the block a valid RBW? * Is the block a valid RBW?
* @return - true if the specified block is a valid RBW * @return - true if the specified block is a valid RBW
*/ */
public boolean isValidRbw(ExtendedBlock b); boolean isValidRbw(ExtendedBlock b);
/** /**
* Invalidates the specified blocks * Invalidates the specified blocks
@ -454,21 +455,21 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param invalidBlks - the blocks to be invalidated * @param invalidBlks - the blocks to be invalidated
* @throws IOException * @throws IOException
*/ */
public void invalidate(String bpid, Block invalidBlks[]) throws IOException; void invalidate(String bpid, Block invalidBlks[]) throws IOException;
/** /**
* Caches the specified blocks * Caches the specified blocks
* @param bpid Block pool id * @param bpid Block pool id
* @param blockIds - block ids to cache * @param blockIds - block ids to cache
*/ */
public void cache(String bpid, long[] blockIds); void cache(String bpid, long[] blockIds);
/** /**
* Uncaches the specified blocks * Uncaches the specified blocks
* @param bpid Block pool id * @param bpid Block pool id
* @param blockIds - blocks ids to uncache * @param blockIds - blocks ids to uncache
*/ */
public void uncache(String bpid, long[] blockIds); void uncache(String bpid, long[] blockIds);
/** /**
* Determine if the specified block is cached. * Determine if the specified block is cached.
@ -476,18 +477,18 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param blockIds - block id * @param blockIds - block id
* @return true if the block is cached * @return true if the block is cached
*/ */
public boolean isCached(String bpid, long blockId); boolean isCached(String bpid, long blockId);
/** /**
* Check if all the data directories are healthy * Check if all the data directories are healthy
* @return A set of unhealthy data directories. * @return A set of unhealthy data directories.
*/ */
public Set<File> checkDataDir(); Set<File> checkDataDir();
/** /**
* Shutdown the FSDataset * Shutdown the FSDataset
*/ */
public void shutdown(); void shutdown();
/** /**
* Sets the file pointer of the checksum stream so that the last checksum * Sets the file pointer of the checksum stream so that the last checksum
@ -497,7 +498,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param checksumSize number of bytes each checksum has * @param checksumSize number of bytes each checksum has
* @throws IOException * @throws IOException
*/ */
public void adjustCrcChannelPosition(ExtendedBlock b, void adjustCrcChannelPosition(ExtendedBlock b,
ReplicaOutputStreams outs, int checksumSize) throws IOException; ReplicaOutputStreams outs, int checksumSize) throws IOException;
/** /**
@ -505,7 +506,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return true if more than the minimum number of valid volumes are left * @return true if more than the minimum number of valid volumes are left
* in the FSDataSet. * in the FSDataSet.
*/ */
public boolean hasEnoughResource(); boolean hasEnoughResource();
/** /**
* Get visible length of the specified replica. * Get visible length of the specified replica.
@ -517,14 +518,14 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return actual state of the replica on this data-node or * @return actual state of the replica on this data-node or
* null if data-node does not have the replica. * null if data-node does not have the replica.
*/ */
public ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock
) throws IOException; ) throws IOException;
/** /**
* Update replica's generation stamp and length and finalize it. * Update replica's generation stamp and length and finalize it.
* @return the ID of storage that stores the block * @return the ID of storage that stores the block
*/ */
public String updateReplicaUnderRecovery(ExtendedBlock oldBlock, String updateReplicaUnderRecovery(ExtendedBlock oldBlock,
long recoveryId, long newBlockId, long newLength) throws IOException; long recoveryId, long newBlockId, long newLength) throws IOException;
/** /**
@ -532,14 +533,14 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @param bpid Block pool Id * @param bpid Block pool Id
* @param conf Configuration * @param conf Configuration
*/ */
public void addBlockPool(String bpid, Configuration conf) throws IOException; void addBlockPool(String bpid, Configuration conf) throws IOException;
/** /**
* Shutdown and remove the block pool from underlying storage. * Shutdown and remove the block pool from underlying storage.
* @param bpid Block pool Id to be removed * @param bpid Block pool Id to be removed
*/ */
public void shutdownBlockPool(String bpid) ; void shutdownBlockPool(String bpid) ;
/** /**
* Deletes the block pool directories. If force is false, directories are * Deletes the block pool directories. If force is false, directories are
* deleted only if no block files exist for the block pool. If force * deleted only if no block files exist for the block pool. If force
@ -551,12 +552,12 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* directory for the blockpool is deleted along with its contents. * directory for the blockpool is deleted along with its contents.
* @throws IOException * @throws IOException
*/ */
public void deleteBlockPool(String bpid, boolean force) throws IOException; void deleteBlockPool(String bpid, boolean force) throws IOException;
/** /**
* Get {@link BlockLocalPathInfo} for the given block. * Get {@link BlockLocalPathInfo} for the given block.
*/ */
public BlockLocalPathInfo getBlockLocalPathInfo(ExtendedBlock b BlockLocalPathInfo getBlockLocalPathInfo(ExtendedBlock b
) throws IOException; ) throws IOException;
/** /**
@ -568,7 +569,7 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* @return metadata Metadata for the list of blocks * @return metadata Metadata for the list of blocks
* @throws IOException * @throws IOException
*/ */
public HdfsBlocksMetadata getHdfsBlocksMetadata(String bpid, HdfsBlocksMetadata getHdfsBlocksMetadata(String bpid,
long[] blockIds) throws IOException; long[] blockIds) throws IOException;
/** /**
@ -576,51 +577,51 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* moved to a separate trash directory instead of being deleted immediately. * moved to a separate trash directory instead of being deleted immediately.
* This can be useful for example during rolling upgrades. * This can be useful for example during rolling upgrades.
*/ */
public void enableTrash(String bpid); void enableTrash(String bpid);
/** /**
* Clear trash * Clear trash
*/ */
public void clearTrash(String bpid); void clearTrash(String bpid);
/** /**
* @return true when trash is enabled * @return true when trash is enabled
*/ */
public boolean trashEnabled(String bpid); boolean trashEnabled(String bpid);
/** /**
* Create a marker file indicating that a rolling upgrade is in progress. * Create a marker file indicating that a rolling upgrade is in progress.
*/ */
public void setRollingUpgradeMarker(String bpid) throws IOException; void setRollingUpgradeMarker(String bpid) throws IOException;
/** /**
* Delete the rolling upgrade marker file if it exists. * Delete the rolling upgrade marker file if it exists.
* @param bpid * @param bpid
*/ */
public void clearRollingUpgradeMarker(String bpid) throws IOException; void clearRollingUpgradeMarker(String bpid) throws IOException;
/** /**
* submit a sync_file_range request to AsyncDiskService * submit a sync_file_range request to AsyncDiskService.
*/ */
public void submitBackgroundSyncFileRangeRequest(final ExtendedBlock block, void submitBackgroundSyncFileRangeRequest(final ExtendedBlock block,
final FileDescriptor fd, final long offset, final long nbytes, final FileDescriptor fd, final long offset, final long nbytes,
final int flags); final int flags);
/** /**
* Callback from RamDiskAsyncLazyPersistService upon async lazy persist task end * Callback from RamDiskAsyncLazyPersistService upon async lazy persist task end
*/ */
public void onCompleteLazyPersist(String bpId, long blockId, void onCompleteLazyPersist(String bpId, long blockId,
long creationTime, File[] savedFiles, V targetVolume); long creationTime, File[] savedFiles, V targetVolume);
/** /**
* Callback from RamDiskAsyncLazyPersistService upon async lazy persist task fail * Callback from RamDiskAsyncLazyPersistService upon async lazy persist task fail
*/ */
public void onFailLazyPersist(String bpId, long blockId); void onFailLazyPersist(String bpId, long blockId);
/** /**
* Move block from one storage to another storage * Move block from one storage to another storage
*/ */
public ReplicaInfo moveBlockAcrossStorage(final ExtendedBlock block, ReplicaInfo moveBlockAcrossStorage(final ExtendedBlock block,
StorageType targetStorageType) throws IOException; StorageType targetStorageType) throws IOException;
/** /**
@ -629,15 +630,15 @@ public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean {
* *
* It is a no-op when dfs.datanode.block-pinning.enabled is set to false. * It is a no-op when dfs.datanode.block-pinning.enabled is set to false.
*/ */
public void setPinning(ExtendedBlock block) throws IOException; void setPinning(ExtendedBlock block) throws IOException;
/** /**
* Check whether the block was pinned * Check whether the block was pinned
*/ */
public boolean getPinning(ExtendedBlock block) throws IOException; boolean getPinning(ExtendedBlock block) throws IOException;
/** /**
* Confirm whether the block is deleting * Confirm whether the block is deleting
*/ */
public boolean isDeletingBlock(String bpid, long blockId); boolean isDeletingBlock(String bpid, long blockId);
} }

View File

@ -39,38 +39,38 @@ public interface FsVolumeSpi {
FsVolumeReference obtainReference() throws ClosedChannelException; FsVolumeReference obtainReference() throws ClosedChannelException;
/** @return the StorageUuid of the volume */ /** @return the StorageUuid of the volume */
public String getStorageID(); String getStorageID();
/** @return a list of block pools. */ /** @return a list of block pools. */
public String[] getBlockPoolList(); String[] getBlockPoolList();
/** @return the available storage space in bytes. */ /** @return the available storage space in bytes. */
public long getAvailable() throws IOException; long getAvailable() throws IOException;
/** @return the base path to the volume */ /** @return the base path to the volume */
public String getBasePath(); String getBasePath();
/** @return the path to the volume */ /** @return the path to the volume */
public String getPath(String bpid) throws IOException; String getPath(String bpid) throws IOException;
/** @return the directory for the finalized blocks in the block pool. */ /** @return the directory for the finalized blocks in the block pool. */
public File getFinalizedDir(String bpid) throws IOException; File getFinalizedDir(String bpid) throws IOException;
public StorageType getStorageType(); StorageType getStorageType();
/** Returns true if the volume is NOT backed by persistent storage. */
boolean isTransientStorage();
/** /**
* Reserve disk space for an RBW block so a writer does not run out of * Reserve disk space for an RBW block so a writer does not run out of
* space before the block is full. * space before the block is full.
*/ */
public void reserveSpaceForRbw(long bytesToReserve); void reserveSpaceForRbw(long bytesToReserve);
/** /**
* Release disk space previously reserved for RBW block. * Release disk space previously reserved for RBW block.
*/ */
public void releaseReservedSpace(long bytesToRelease); void releaseReservedSpace(long bytesToRelease);
/** Returns true if the volume is NOT backed by persistent storage. */
public boolean isTransientStorage();
/** /**
* Release reserved memory for an RBW block written to transient storage * Release reserved memory for an RBW block written to transient storage
@ -78,7 +78,7 @@ public interface FsVolumeSpi {
* bytesToRelease will be rounded down to the OS page size since locked * bytesToRelease will be rounded down to the OS page size since locked
* memory reservation must always be a multiple of the page size. * memory reservation must always be a multiple of the page size.
*/ */
public void releaseLockedMemory(long bytesToRelease); void releaseLockedMemory(long bytesToRelease);
/** /**
* BlockIterator will return ExtendedBlock entries from a block pool in * BlockIterator will return ExtendedBlock entries from a block pool in
@ -90,7 +90,7 @@ public interface FsVolumeSpi {
* *
* Closing the iterator does not save it. You must call save to save it. * Closing the iterator does not save it. You must call save to save it.
*/ */
public interface BlockIterator extends Closeable { interface BlockIterator extends Closeable {
/** /**
* Get the next block.<p/> * Get the next block.<p/>
* *
@ -107,17 +107,17 @@ public interface FsVolumeSpi {
* this volume. In this case, EOF will be set on * this volume. In this case, EOF will be set on
* the iterator. * the iterator.
*/ */
public ExtendedBlock nextBlock() throws IOException; ExtendedBlock nextBlock() throws IOException;
/** /**
* Returns true if we got to the end of the block pool. * Returns true if we got to the end of the block pool.
*/ */
public boolean atEnd(); boolean atEnd();
/** /**
* Repositions the iterator at the beginning of the block pool. * Repositions the iterator at the beginning of the block pool.
*/ */
public void rewind(); void rewind();
/** /**
* Save this block iterator to the underlying volume. * Save this block iterator to the underlying volume.
@ -127,7 +127,7 @@ public interface FsVolumeSpi {
* @throws IOException If there was an error when saving the block * @throws IOException If there was an error when saving the block
* iterator. * iterator.
*/ */
public void save() throws IOException; void save() throws IOException;
/** /**
* Set the maximum staleness of entries that we will return.<p/> * Set the maximum staleness of entries that we will return.<p/>
@ -138,25 +138,25 @@ public interface FsVolumeSpi {
* to 0, consumers of this API must handle race conditions where block * to 0, consumers of this API must handle race conditions where block
* disappear before they can be processed. * disappear before they can be processed.
*/ */
public void setMaxStalenessMs(long maxStalenessMs); void setMaxStalenessMs(long maxStalenessMs);
/** /**
* Get the wall-clock time, measured in milliseconds since the Epoch, * Get the wall-clock time, measured in milliseconds since the Epoch,
* when this iterator was created. * when this iterator was created.
*/ */
public long getIterStartMs(); long getIterStartMs();
/** /**
* Get the wall-clock time, measured in milliseconds since the Epoch, * Get the wall-clock time, measured in milliseconds since the Epoch,
* when this iterator was last saved. Returns iterStartMs if the * when this iterator was last saved. Returns iterStartMs if the
* iterator was never saved. * iterator was never saved.
*/ */
public long getLastSavedMs(); long getLastSavedMs();
/** /**
* Get the id of the block pool which this iterator traverses. * Get the id of the block pool which this iterator traverses.
*/ */
public String getBlockPoolId(); String getBlockPoolId();
} }
/** /**
@ -168,7 +168,7 @@ public interface FsVolumeSpi {
* *
* @return The new block iterator. * @return The new block iterator.
*/ */
public BlockIterator newBlockIterator(String bpid, String name); BlockIterator newBlockIterator(String bpid, String name);
/** /**
* Load a saved block iterator. * Load a saved block iterator.
@ -180,11 +180,10 @@ public interface FsVolumeSpi {
* @throws IOException If there was an IO error loading the saved * @throws IOException If there was an IO error loading the saved
* block iterator. * block iterator.
*/ */
public BlockIterator loadBlockIterator(String bpid, String name) BlockIterator loadBlockIterator(String bpid, String name) throws IOException;
throws IOException;
/** /**
* Get the FSDatasetSpi which this volume is a part of. * Get the FSDatasetSpi which this volume is a part of.
*/ */
public FsDatasetSpi getDataset(); FsDatasetSpi getDataset();
} }