HDFS-8620. Clean up the checkstyle warinings about ClientProtocol. Contributed by Takanobu Asanuma.

This commit is contained in:
Haohui Mai 2015-07-07 14:01:19 -07:00
parent 9bbc3e4ad4
commit b181c13cbf
3 changed files with 293 additions and 323 deletions

View File

@ -43,7 +43,8 @@ public interface HdfsClientConfigKeys {
String DFS_NAMENODE_HTTP_PORT_KEY = "dfs.http.port"; String DFS_NAMENODE_HTTP_PORT_KEY = "dfs.http.port";
String DFS_NAMENODE_HTTPS_PORT_KEY = "dfs.https.port"; String DFS_NAMENODE_HTTPS_PORT_KEY = "dfs.https.port";
int DFS_NAMENODE_RPC_PORT_DEFAULT = 8020; int DFS_NAMENODE_RPC_PORT_DEFAULT = 8020;
String DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY = "dfs.namenode.kerberos.principal"; String DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY =
"dfs.namenode.kerberos.principal";
/** dfs.client.retry configuration properties */ /** dfs.client.retry configuration properties */
interface Retry { interface Retry {

View File

@ -96,13 +96,14 @@ public interface ClientProtocol {
* 69L is the last version id when this class was used for protocols * 69L is the last version id when this class was used for protocols
* serialization. DO not update this version any further. * serialization. DO not update this version any further.
*/ */
public static final long versionID = 69L; long versionID = 69L;
/////////////////////////////////////// ///////////////////////////////////////
// File contents // File contents
/////////////////////////////////////// ///////////////////////////////////////
/** /**
* Get locations of the blocks of the specified file within the specified range. * Get locations of the blocks of the specified file
* within the specified range.
* DataNode locations for each block are sorted by * DataNode locations for each block are sorted by
* the proximity to the client. * the proximity to the client.
* <p> * <p>
@ -126,11 +127,8 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public LocatedBlocks getBlockLocations(String src, LocatedBlocks getBlockLocations(String src, long offset, long length)
long offset, throws IOException;
long length)
throws AccessControlException, FileNotFoundException,
UnresolvedLinkException, IOException;
/** /**
* Get server default values for a number of configuration params. * Get server default values for a number of configuration params.
@ -138,7 +136,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public FsServerDefaults getServerDefaults() throws IOException; FsServerDefaults getServerDefaults() throws IOException;
/** /**
* Create a new file entry in the namespace. * Create a new file entry in the namespace.
@ -148,8 +146,8 @@ public interface ClientProtocol {
* The name-node does not have a notion of "current" directory for a client. * The name-node does not have a notion of "current" directory for a client.
* <p> * <p>
* Once created, the file is visible and available for read to other clients. * Once created, the file is visible and available for read to other clients.
* Although, other clients cannot {@link #delete(String, boolean)}, re-create or * Although, other clients cannot {@link #delete(String, boolean)}, re-create
* {@link #rename(String, String)} it until the file is completed * or {@link #rename(String, String)} it until the file is completed
* or explicitly as a result of lease expiration. * or explicitly as a result of lease expiration.
* <p> * <p>
* Blocks have a maximum size. Clients that intend to create * Blocks have a maximum size. Clients that intend to create
@ -190,15 +188,11 @@ public interface ClientProtocol {
* <em>Note that create with {@link CreateFlag#OVERWRITE} is idempotent.</em> * <em>Note that create with {@link CreateFlag#OVERWRITE} is idempotent.</em>
*/ */
@AtMostOnce @AtMostOnce
public HdfsFileStatus create(String src, FsPermission masked, HdfsFileStatus create(String src, FsPermission masked,
String clientName, EnumSetWritable<CreateFlag> flag, String clientName, EnumSetWritable<CreateFlag> flag,
boolean createParent, short replication, long blockSize, boolean createParent, short replication, long blockSize,
CryptoProtocolVersion[] supportedVersions) CryptoProtocolVersion[] supportedVersions)
throws AccessControlException, AlreadyBeingCreatedException, throws IOException;
DSQuotaExceededException, FileAlreadyExistsException,
FileNotFoundException, NSQuotaExceededException,
ParentNotDirectoryException, SafeModeException, UnresolvedLinkException,
SnapshotAccessControlException, IOException;
/** /**
* Append to the end of the file. * Append to the end of the file.
@ -227,10 +221,8 @@ public interface ClientProtocol {
* @throws UnsupportedOperationException if append is not supported * @throws UnsupportedOperationException if append is not supported
*/ */
@AtMostOnce @AtMostOnce
public LastBlockWithStatus append(String src, String clientName, LastBlockWithStatus append(String src, String clientName,
EnumSetWritable<CreateFlag> flag) throws AccessControlException, EnumSetWritable<CreateFlag> flag) throws IOException;
DSQuotaExceededException, FileNotFoundException, SafeModeException,
UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** /**
* Set replication for an existing file. * Set replication for an existing file.
@ -256,20 +248,18 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public boolean setReplication(String src, short replication) boolean setReplication(String src, short replication)
throws AccessControlException, DSQuotaExceededException, throws IOException;
FileNotFoundException, SafeModeException, UnresolvedLinkException,
SnapshotAccessControlException, IOException;
/** /**
* Get all the available block storage policies. * Get all the available block storage policies.
* @return All the in-use block storage policies currently. * @return All the in-use block storage policies currently.
*/ */
@Idempotent @Idempotent
public BlockStoragePolicy[] getStoragePolicies() throws IOException; BlockStoragePolicy[] getStoragePolicies() throws IOException;
/** /**
* Set the storage policy for a file/directory * Set the storage policy for a file/directory.
* @param src Path of an existing file/directory. * @param src Path of an existing file/directory.
* @param policyName The name of the storage policy * @param policyName The name of the storage policy
* @throws SnapshotAccessControlException If access is denied * @throws SnapshotAccessControlException If access is denied
@ -278,9 +268,8 @@ public interface ClientProtocol {
* @throws QuotaExceededException If changes violate the quota restriction * @throws QuotaExceededException If changes violate the quota restriction
*/ */
@Idempotent @Idempotent
public void setStoragePolicy(String src, String policyName) void setStoragePolicy(String src, String policyName)
throws SnapshotAccessControlException, UnresolvedLinkException, throws IOException;
FileNotFoundException, QuotaExceededException, IOException;
/** /**
* Set permissions for an existing file/directory. * Set permissions for an existing file/directory.
@ -293,9 +282,8 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public void setPermission(String src, FsPermission permission) void setPermission(String src, FsPermission permission)
throws AccessControlException, FileNotFoundException, SafeModeException, throws IOException;
UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** /**
* Set Owner of a path (i.e. a file or a directory). * Set Owner of a path (i.e. a file or a directory).
@ -312,9 +300,8 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public void setOwner(String src, String username, String groupname) void setOwner(String src, String username, String groupname)
throws AccessControlException, FileNotFoundException, SafeModeException, throws IOException;
UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** /**
* The client can give up on a block by calling abandonBlock(). * The client can give up on a block by calling abandonBlock().
@ -334,10 +321,9 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public void abandonBlock(ExtendedBlock b, long fileId, void abandonBlock(ExtendedBlock b, long fileId,
String src, String holder) String src, String holder)
throws AccessControlException, FileNotFoundException, throws IOException;
UnresolvedLinkException, IOException;
/** /**
* A client that wants to write an additional block to the * A client that wants to write an additional block to the
@ -372,12 +358,10 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public LocatedBlock addBlock(String src, String clientName, LocatedBlock addBlock(String src, String clientName,
ExtendedBlock previous, DatanodeInfo[] excludeNodes, long fileId, ExtendedBlock previous, DatanodeInfo[] excludeNodes, long fileId,
String[] favoredNodes) String[] favoredNodes)
throws AccessControlException, FileNotFoundException, throws IOException;
NotReplicatedYetException, SafeModeException, UnresolvedLinkException,
IOException;
/** /**
* Get a datanode for an existing pipeline. * Get a datanode for an existing pipeline.
@ -399,14 +383,13 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public LocatedBlock getAdditionalDatanode(final String src, LocatedBlock getAdditionalDatanode(final String src,
final long fileId, final ExtendedBlock blk, final long fileId, final ExtendedBlock blk,
final DatanodeInfo[] existings, final DatanodeInfo[] existings,
final String[] existingStorageIDs, final String[] existingStorageIDs,
final DatanodeInfo[] excludes, final DatanodeInfo[] excludes,
final int numAdditionalNodes, final String clientName final int numAdditionalNodes, final String clientName
) throws AccessControlException, FileNotFoundException, ) throws IOException;
SafeModeException, UnresolvedLinkException, IOException;
/** /**
* The client is done writing data to the given filename, and would * The client is done writing data to the given filename, and would
@ -438,10 +421,9 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public boolean complete(String src, String clientName, boolean complete(String src, String clientName,
ExtendedBlock last, long fileId) ExtendedBlock last, long fileId)
throws AccessControlException, FileNotFoundException, SafeModeException, throws IOException;
UnresolvedLinkException, IOException;
/** /**
* The client wants to report corrupted blocks (blocks with specified * The client wants to report corrupted blocks (blocks with specified
@ -449,7 +431,7 @@ public interface ClientProtocol {
* @param blocks Array of located blocks to report * @param blocks Array of located blocks to report
*/ */
@Idempotent @Idempotent
public void reportBadBlocks(LocatedBlock[] blocks) throws IOException; void reportBadBlocks(LocatedBlock[] blocks) throws IOException;
/////////////////////////////////////// ///////////////////////////////////////
// Namespace management // Namespace management
@ -465,11 +447,11 @@ public interface ClientProtocol {
* @throws IOException an I/O error occurred * @throws IOException an I/O error occurred
*/ */
@AtMostOnce @AtMostOnce
public boolean rename(String src, String dst) boolean rename(String src, String dst)
throws UnresolvedLinkException, SnapshotAccessControlException, IOException; throws IOException;
/** /**
* Moves blocks from srcs to trg and delete srcs * Moves blocks from srcs to trg and delete srcs.
* *
* @param trg existing file * @param trg existing file
* @param srcs - list of existing files (same block size, same replication) * @param srcs - list of existing files (same block size, same replication)
@ -479,8 +461,8 @@ public interface ClientProtocol {
* @throws SnapshotAccessControlException if path is in RO snapshot * @throws SnapshotAccessControlException if path is in RO snapshot
*/ */
@AtMostOnce @AtMostOnce
public void concat(String trg, String[] srcs) void concat(String trg, String[] srcs)
throws IOException, UnresolvedLinkException, SnapshotAccessControlException; throws IOException;
/** /**
* Rename src to dst. * Rename src to dst.
@ -504,7 +486,7 @@ public interface ClientProtocol {
* @throws DSQuotaExceededException If rename violates disk space * @throws DSQuotaExceededException If rename violates disk space
* quota restriction * quota restriction
* @throws FileAlreadyExistsException If <code>dst</code> already exists and * @throws FileAlreadyExistsException If <code>dst</code> already exists and
* <code>options</options> has {@link Rename#OVERWRITE} option * <code>options</code> has {@link Rename#OVERWRITE} option
* false. * false.
* @throws FileNotFoundException If <code>src</code> does not exist * @throws FileNotFoundException If <code>src</code> does not exist
* @throws NSQuotaExceededException If rename violates namespace * @throws NSQuotaExceededException If rename violates namespace
@ -518,11 +500,8 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@AtMostOnce @AtMostOnce
public void rename2(String src, String dst, Options.Rename... options) void rename2(String src, String dst, Options.Rename... options)
throws AccessControlException, DSQuotaExceededException, throws IOException;
FileAlreadyExistsException, FileNotFoundException,
NSQuotaExceededException, ParentNotDirectoryException, SafeModeException,
UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** /**
* Truncate file src to new size. * Truncate file src to new size.
@ -550,9 +529,8 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public boolean truncate(String src, long newLength, String clientName) boolean truncate(String src, long newLength, String clientName)
throws AccessControlException, FileNotFoundException, SafeModeException, throws IOException;
UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** /**
* Delete the given file or directory from the file system. * Delete the given file or directory from the file system.
@ -573,9 +551,8 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@AtMostOnce @AtMostOnce
public boolean delete(String src, boolean recursive) boolean delete(String src, boolean recursive)
throws AccessControlException, FileNotFoundException, SafeModeException, throws IOException;
UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** /**
* Create a directory (or hierarchy of directories) with the given * Create a directory (or hierarchy of directories) with the given
@ -591,7 +568,8 @@ public interface ClientProtocol {
* @throws FileAlreadyExistsException If <code>src</code> already exists * @throws FileAlreadyExistsException If <code>src</code> already exists
* @throws FileNotFoundException If parent of <code>src</code> does not exist * @throws FileNotFoundException If parent of <code>src</code> does not exist
* and <code>createParent</code> is false * and <code>createParent</code> is false
* @throws NSQuotaExceededException If file creation violates quota restriction * @throws NSQuotaExceededException If file creation violates quota
* restriction
* @throws ParentNotDirectoryException If parent of <code>src</code> * @throws ParentNotDirectoryException If parent of <code>src</code>
* is not a directory * is not a directory
* @throws SafeModeException create not allowed in safemode * @throws SafeModeException create not allowed in safemode
@ -603,14 +581,11 @@ public interface ClientProtocol {
* @throws InvalidPathException If <code>src</code> is invalid * @throws InvalidPathException If <code>src</code> is invalid
*/ */
@Idempotent @Idempotent
public boolean mkdirs(String src, FsPermission masked, boolean createParent) boolean mkdirs(String src, FsPermission masked, boolean createParent)
throws AccessControlException, FileAlreadyExistsException, throws IOException;
FileNotFoundException, NSQuotaExceededException,
ParentNotDirectoryException, SafeModeException, UnresolvedLinkException,
SnapshotAccessControlException, IOException;
/** /**
* Get a partial listing of the indicated directory * Get a partial listing of the indicated directory.
* *
* @param src the directory name * @param src the directory name
* @param startAfter the name to start listing after encoded in java UTF8 * @param startAfter the name to start listing after encoded in java UTF8
@ -624,20 +599,17 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public DirectoryListing getListing(String src, DirectoryListing getListing(String src, byte[] startAfter,
byte[] startAfter, boolean needLocation) throws IOException;
boolean needLocation)
throws AccessControlException, FileNotFoundException,
UnresolvedLinkException, IOException;
/** /**
* Get listing of all the snapshottable directories * Get listing of all the snapshottable directories.
* *
* @return Information about all the current snapshottable directory * @return Information about all the current snapshottable directory
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public SnapshottableDirectoryStatus[] getSnapshottableDirListing() SnapshottableDirectoryStatus[] getSnapshottableDirListing()
throws IOException; throws IOException;
/////////////////////////////////////// ///////////////////////////////////////
@ -664,8 +636,7 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public void renewLease(String clientName) throws AccessControlException, void renewLease(String clientName) throws IOException;
IOException;
/** /**
* Start lease recovery. * Start lease recovery.
@ -677,15 +648,15 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public boolean recoverLease(String src, String clientName) throws IOException; boolean recoverLease(String src, String clientName) throws IOException;
public int GET_STATS_CAPACITY_IDX = 0; int GET_STATS_CAPACITY_IDX = 0;
public int GET_STATS_USED_IDX = 1; int GET_STATS_USED_IDX = 1;
public int GET_STATS_REMAINING_IDX = 2; int GET_STATS_REMAINING_IDX = 2;
public int GET_STATS_UNDER_REPLICATED_IDX = 3; int GET_STATS_UNDER_REPLICATED_IDX = 3;
public int GET_STATS_CORRUPT_BLOCKS_IDX = 4; int GET_STATS_CORRUPT_BLOCKS_IDX = 4;
public int GET_STATS_MISSING_BLOCKS_IDX = 5; int GET_STATS_MISSING_BLOCKS_IDX = 5;
public int GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX = 6; int GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX = 6;
/** /**
* Get a set of statistics about the filesystem. * Get a set of statistics about the filesystem.
@ -704,7 +675,7 @@ public interface ClientProtocol {
* actual numbers to index into the array. * actual numbers to index into the array.
*/ */
@Idempotent @Idempotent
public long[] getStats() throws IOException; long[] getStats() throws IOException;
/** /**
* Get a report on the system's current datanodes. * Get a report on the system's current datanodes.
@ -713,14 +684,14 @@ public interface ClientProtocol {
* otherwise all datanodes if type is ALL. * otherwise all datanodes if type is ALL.
*/ */
@Idempotent @Idempotent
public DatanodeInfo[] getDatanodeReport(HdfsConstants.DatanodeReportType type) DatanodeInfo[] getDatanodeReport(HdfsConstants.DatanodeReportType type)
throws IOException; throws IOException;
/** /**
* Get a report on the current datanode storages. * Get a report on the current datanode storages.
*/ */
@Idempotent @Idempotent
public DatanodeStorageReport[] getDatanodeStorageReport( DatanodeStorageReport[] getDatanodeStorageReport(
HdfsConstants.DatanodeReportType type) throws IOException; HdfsConstants.DatanodeReportType type) throws IOException;
/** /**
@ -731,8 +702,8 @@ public interface ClientProtocol {
* @throws UnresolvedLinkException if the path contains a symlink. * @throws UnresolvedLinkException if the path contains a symlink.
*/ */
@Idempotent @Idempotent
public long getPreferredBlockSize(String filename) long getPreferredBlockSize(String filename)
throws IOException, UnresolvedLinkException; throws IOException;
/** /**
* Enter, leave or get safe mode. * Enter, leave or get safe mode.
@ -744,7 +715,8 @@ public interface ClientProtocol {
* <p> * <p>
* Safe mode is entered automatically at name node startup. * Safe mode is entered automatically at name node startup.
* Safe mode can also be entered manually using * Safe mode can also be entered manually using
* {@link #setSafeMode(HdfsConstants.SafeModeAction,boolean) setSafeMode(SafeModeAction.SAFEMODE_ENTER,false)}. * {@link #setSafeMode(HdfsConstants.SafeModeAction,boolean)
* setSafeMode(SafeModeAction.SAFEMODE_ENTER,false)}.
* <p> * <p>
* At startup the name node accepts data node reports collecting * At startup the name node accepts data node reports collecting
* information about block locations. * information about block locations.
@ -760,11 +732,14 @@ public interface ClientProtocol {
* Then the name node leaves safe mode. * Then the name node leaves safe mode.
* <p> * <p>
* If safe mode is turned on manually using * If safe mode is turned on manually using
* {@link #setSafeMode(HdfsConstants.SafeModeAction,boolean) setSafeMode(SafeModeAction.SAFEMODE_ENTER,false)} * {@link #setSafeMode(HdfsConstants.SafeModeAction,boolean)
* setSafeMode(SafeModeAction.SAFEMODE_ENTER,false)}
* then the name node stays in safe mode until it is manually turned off * then the name node stays in safe mode until it is manually turned off
* using {@link #setSafeMode(HdfsConstants.SafeModeAction,boolean) setSafeMode(SafeModeAction.SAFEMODE_LEAVE,false)}. * using {@link #setSafeMode(HdfsConstants.SafeModeAction,boolean)
* setSafeMode(SafeModeAction.SAFEMODE_LEAVE,false)}.
* Current state of the name node can be verified using * Current state of the name node can be verified using
* {@link #setSafeMode(HdfsConstants.SafeModeAction,boolean) setSafeMode(SafeModeAction.SAFEMODE_GET,false)} * {@link #setSafeMode(HdfsConstants.SafeModeAction,boolean)
* setSafeMode(SafeModeAction.SAFEMODE_GET,false)}
* <h4>Configuration parameters:</h4> * <h4>Configuration parameters:</h4>
* <tt>dfs.safemode.threshold.pct</tt> is the threshold parameter.<br> * <tt>dfs.safemode.threshold.pct</tt> is the threshold parameter.<br>
* <tt>dfs.safemode.extension</tt> is the safe mode extension parameter.<br> * <tt>dfs.safemode.extension</tt> is the safe mode extension parameter.<br>
@ -790,7 +765,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public boolean setSafeMode(HdfsConstants.SafeModeAction action, boolean isChecked) boolean setSafeMode(HdfsConstants.SafeModeAction action, boolean isChecked)
throws IOException; throws IOException;
/** /**
@ -803,8 +778,7 @@ public interface ClientProtocol {
* @throws IOException if image creation failed. * @throws IOException if image creation failed.
*/ */
@AtMostOnce @AtMostOnce
public void saveNamespace() throws AccessControlException, IOException; void saveNamespace() throws IOException;
/** /**
* Roll the edit log. * Roll the edit log.
@ -815,7 +789,7 @@ public interface ClientProtocol {
* @return the txid of the new segment * @return the txid of the new segment
*/ */
@Idempotent @Idempotent
public long rollEdits() throws AccessControlException, IOException; long rollEdits() throws IOException;
/** /**
* Enable/Disable restore failed storage. * Enable/Disable restore failed storage.
@ -825,15 +799,14 @@ public interface ClientProtocol {
* @throws AccessControlException if the superuser privilege is violated. * @throws AccessControlException if the superuser privilege is violated.
*/ */
@Idempotent @Idempotent
public boolean restoreFailedStorage(String arg) boolean restoreFailedStorage(String arg) throws IOException;
throws AccessControlException, IOException;
/** /**
* Tells the namenode to reread the hosts and exclude files. * Tells the namenode to reread the hosts and exclude files.
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public void refreshNodes() throws IOException; void refreshNodes() throws IOException;
/** /**
* Finalize previous upgrade. * Finalize previous upgrade.
@ -843,7 +816,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public void finalizeUpgrade() throws IOException; void finalizeUpgrade() throws IOException;
/** /**
* Rolling upgrade operations. * Rolling upgrade operations.
@ -852,7 +825,7 @@ public interface ClientProtocol {
* progress, returns null. * progress, returns null.
*/ */
@Idempotent @Idempotent
public RollingUpgradeInfo rollingUpgrade(RollingUpgradeAction action) RollingUpgradeInfo rollingUpgrade(RollingUpgradeAction action)
throws IOException; throws IOException;
/** /**
@ -866,7 +839,7 @@ public interface ClientProtocol {
* cookie returned from the previous call. * cookie returned from the previous call.
*/ */
@Idempotent @Idempotent
public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie) CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
throws IOException; throws IOException;
/** /**
@ -876,7 +849,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public void metaSave(String filename) throws IOException; void metaSave(String filename) throws IOException;
/** /**
* Tell all datanodes to use a new, non-persistent bandwidth value for * Tell all datanodes to use a new, non-persistent bandwidth value for
@ -886,7 +859,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public void setBalancerBandwidth(long bandwidth) throws IOException; void setBalancerBandwidth(long bandwidth) throws IOException;
/** /**
* Get the file info for a specific file or directory. * Get the file info for a specific file or directory.
@ -900,11 +873,10 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public HdfsFileStatus getFileInfo(String src) throws AccessControlException, HdfsFileStatus getFileInfo(String src) throws IOException;
FileNotFoundException, UnresolvedLinkException, IOException;
/** /**
* Get the close status of a file * Get the close status of a file.
* @param src The string representation of the path to the file * @param src The string representation of the path to the file
* *
* @return return true if file is closed * @return return true if file is closed
@ -914,8 +886,7 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public boolean isFileClosed(String src) throws AccessControlException, boolean isFileClosed(String src) throws IOException;
FileNotFoundException, UnresolvedLinkException, IOException;
/** /**
* Get the file info for a specific file or directory. If the path * Get the file info for a specific file or directory. If the path
@ -930,8 +901,7 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public HdfsFileStatus getFileLinkInfo(String src) HdfsFileStatus getFileLinkInfo(String src) throws IOException;
throws AccessControlException, UnresolvedLinkException, IOException;
/** /**
* Get {@link ContentSummary} rooted at the specified directory. * Get {@link ContentSummary} rooted at the specified directory.
@ -943,21 +913,19 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public ContentSummary getContentSummary(String path) ContentSummary getContentSummary(String path) throws IOException;
throws AccessControlException, FileNotFoundException,
UnresolvedLinkException, IOException;
/** /**
* Set the quota for a directory. * Set the quota for a directory.
* @param path The string representation of the path to the directory * @param path The string representation of the path to the directory
* @param namespaceQuota Limit on the number of names in the tree rooted * @param namespaceQuota Limit on the number of names in the tree rooted
* at the directory * at the directory
* @param storagespaceQuota Limit on storage space occupied all the files under * @param storagespaceQuota Limit on storage space occupied all the files
* this directory. * under this directory.
* @param type StorageType that the space quota is intended to be set on. * @param type StorageType that the space quota is intended to be set on.
* It may be null when called by traditional space/namespace quota. * It may be null when called by traditional space/namespace
* When type is is not null, the storagespaceQuota parameter is for * quota. When type is is not null, the storagespaceQuota
* type specified and namespaceQuota must be * parameter is for type specified and namespaceQuota must be
* {@link HdfsConstants#QUOTA_DONT_SET}. * {@link HdfsConstants#QUOTA_DONT_SET}.
* *
* <br><br> * <br><br>
@ -971,14 +939,14 @@ public interface ClientProtocol {
* @throws FileNotFoundException file <code>path</code> is not found * @throws FileNotFoundException file <code>path</code> is not found
* @throws QuotaExceededException if the directory size * @throws QuotaExceededException if the directory size
* is greater than the given quota * is greater than the given quota
* @throws UnresolvedLinkException if the <code>path</code> contains a symlink. * @throws UnresolvedLinkException if the <code>path</code> contains
* a symlink.
* @throws SnapshotAccessControlException if path is in RO snapshot * @throws SnapshotAccessControlException if path is in RO snapshot
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public void setQuota(String path, long namespaceQuota, long storagespaceQuota, void setQuota(String path, long namespaceQuota, long storagespaceQuota,
StorageType type) throws AccessControlException, FileNotFoundException, StorageType type) throws IOException;
UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** /**
* Write all metadata for this file into persistent storage. * Write all metadata for this file into persistent storage.
@ -995,17 +963,15 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public void fsync(String src, long inodeId, String client, void fsync(String src, long inodeId, String client, long lastBlockLength)
long lastBlockLength) throws IOException;
throws AccessControlException, FileNotFoundException,
UnresolvedLinkException, IOException;
/** /**
* Sets the modification and access time of the file to the specified time. * Sets the modification and access time of the file to the specified time.
* @param src The string representation of the path * @param src The string representation of the path
* @param mtime The number of milliseconds since Jan 1, 1970. * @param mtime The number of milliseconds since Jan 1, 1970.
* Setting mtime to -1 means that modification time should not be set * Setting mtime to -1 means that modification time should not
* by this call. * be set by this call.
* @param atime The number of milliseconds since Jan 1, 1970. * @param atime The number of milliseconds since Jan 1, 1970.
* Setting atime to -1 means that access time should not be set * Setting atime to -1 means that access time should not be set
* by this call. * by this call.
@ -1017,9 +983,7 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@Idempotent @Idempotent
public void setTimes(String src, long mtime, long atime) void setTimes(String src, long mtime, long atime) throws IOException;
throws AccessControlException, FileNotFoundException,
UnresolvedLinkException, SnapshotAccessControlException, IOException;
/** /**
* Create symlink to a file or directory. * Create symlink to a file or directory.
@ -1036,16 +1000,13 @@ public interface ClientProtocol {
* and <code>createParent</code> is false * and <code>createParent</code> is false
* @throws ParentNotDirectoryException If parent of <code>link</code> is not a * @throws ParentNotDirectoryException If parent of <code>link</code> is not a
* directory. * directory.
* @throws UnresolvedLinkException if <code>link</target> contains a symlink. * @throws UnresolvedLinkException if <code>link</code> contains a symlink.
* @throws SnapshotAccessControlException if path is in RO snapshot * @throws SnapshotAccessControlException if path is in RO snapshot
* @throws IOException If an I/O error occurred * @throws IOException If an I/O error occurred
*/ */
@AtMostOnce @AtMostOnce
public void createSymlink(String target, String link, FsPermission dirPerm, void createSymlink(String target, String link, FsPermission dirPerm,
boolean createParent) throws AccessControlException, boolean createParent) throws IOException;
FileAlreadyExistsException, FileNotFoundException,
ParentNotDirectoryException, SafeModeException, UnresolvedLinkException,
SnapshotAccessControlException, IOException;
/** /**
* Return the target of the given symlink. If there is an intermediate * Return the target of the given symlink. If there is an intermediate
@ -1060,8 +1021,7 @@ public interface ClientProtocol {
* or an I/O error occurred * or an I/O error occurred
*/ */
@Idempotent @Idempotent
public String getLinkTarget(String path) throws AccessControlException, String getLinkTarget(String path) throws IOException;
FileNotFoundException, IOException;
/** /**
* Get a new generation stamp together with an access token for * Get a new generation stamp together with an access token for
@ -1076,11 +1036,11 @@ public interface ClientProtocol {
* @throws IOException if any error occurs * @throws IOException if any error occurs
*/ */
@Idempotent @Idempotent
public LocatedBlock updateBlockForPipeline(ExtendedBlock block, LocatedBlock updateBlockForPipeline(ExtendedBlock block,
String clientName) throws IOException; String clientName) throws IOException;
/** /**
* Update a pipeline for a block under construction * Update a pipeline for a block under construction.
* *
* @param clientName the name of the client * @param clientName the name of the client
* @param oldBlock the old block * @param oldBlock the old block
@ -1089,7 +1049,7 @@ public interface ClientProtocol {
* @throws IOException if any error occurs * @throws IOException if any error occurs
*/ */
@AtMostOnce @AtMostOnce
public void updatePipeline(String clientName, ExtendedBlock oldBlock, void updatePipeline(String clientName, ExtendedBlock oldBlock,
ExtendedBlock newBlock, DatanodeID[] newNodes, String[] newStorageIDs) ExtendedBlock newBlock, DatanodeID[] newNodes, String[] newStorageIDs)
throws IOException; throws IOException;
@ -1101,7 +1061,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public Token<DelegationTokenIdentifier> getDelegationToken(Text renewer) Token<DelegationTokenIdentifier> getDelegationToken(Text renewer)
throws IOException; throws IOException;
/** /**
@ -1112,7 +1072,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public long renewDelegationToken(Token<DelegationTokenIdentifier> token) long renewDelegationToken(Token<DelegationTokenIdentifier> token)
throws IOException; throws IOException;
/** /**
@ -1122,7 +1082,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public void cancelDelegationToken(Token<DelegationTokenIdentifier> token) void cancelDelegationToken(Token<DelegationTokenIdentifier> token)
throws IOException; throws IOException;
/** /**
@ -1131,38 +1091,38 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public DataEncryptionKey getDataEncryptionKey() throws IOException; DataEncryptionKey getDataEncryptionKey() throws IOException;
/** /**
* Create a snapshot * Create a snapshot.
* @param snapshotRoot the path that is being snapshotted * @param snapshotRoot the path that is being snapshotted
* @param snapshotName name of the snapshot created * @param snapshotName name of the snapshot created
* @return the snapshot path. * @return the snapshot path.
* @throws IOException * @throws IOException
*/ */
@AtMostOnce @AtMostOnce
public String createSnapshot(String snapshotRoot, String snapshotName) String createSnapshot(String snapshotRoot, String snapshotName)
throws IOException; throws IOException;
/** /**
* Delete a specific snapshot of a snapshottable directory * Delete a specific snapshot of a snapshottable directory.
* @param snapshotRoot The snapshottable directory * @param snapshotRoot The snapshottable directory
* @param snapshotName Name of the snapshot for the snapshottable directory * @param snapshotName Name of the snapshot for the snapshottable directory
* @throws IOException * @throws IOException
*/ */
@AtMostOnce @AtMostOnce
public void deleteSnapshot(String snapshotRoot, String snapshotName) void deleteSnapshot(String snapshotRoot, String snapshotName)
throws IOException; throws IOException;
/** /**
* Rename a snapshot * Rename a snapshot.
* @param snapshotRoot the directory path where the snapshot was taken * @param snapshotRoot the directory path where the snapshot was taken
* @param snapshotOldName old name of the snapshot * @param snapshotOldName old name of the snapshot
* @param snapshotNewName new name of the snapshot * @param snapshotNewName new name of the snapshot
* @throws IOException * @throws IOException
*/ */
@AtMostOnce @AtMostOnce
public void renameSnapshot(String snapshotRoot, String snapshotOldName, void renameSnapshot(String snapshotRoot, String snapshotOldName,
String snapshotNewName) throws IOException; String snapshotNewName) throws IOException;
/** /**
@ -1171,7 +1131,7 @@ public interface ClientProtocol {
* @throws IOException on error * @throws IOException on error
*/ */
@Idempotent @Idempotent
public void allowSnapshot(String snapshotRoot) void allowSnapshot(String snapshotRoot)
throws IOException; throws IOException;
/** /**
@ -1180,7 +1140,7 @@ public interface ClientProtocol {
* @throws IOException on error * @throws IOException on error
*/ */
@Idempotent @Idempotent
public void disallowSnapshot(String snapshotRoot) void disallowSnapshot(String snapshotRoot)
throws IOException; throws IOException;
/** /**
@ -1199,7 +1159,7 @@ public interface ClientProtocol {
* @throws IOException on error * @throws IOException on error
*/ */
@Idempotent @Idempotent
public SnapshotDiffReport getSnapshotDiffReport(String snapshotRoot, SnapshotDiffReport getSnapshotDiffReport(String snapshotRoot,
String fromSnapshot, String toSnapshot) throws IOException; String fromSnapshot, String toSnapshot) throws IOException;
/** /**
@ -1211,7 +1171,7 @@ public interface ClientProtocol {
* @throws IOException if the directive could not be added * @throws IOException if the directive could not be added
*/ */
@AtMostOnce @AtMostOnce
public long addCacheDirective(CacheDirectiveInfo directive, long addCacheDirective(CacheDirectiveInfo directive,
EnumSet<CacheFlag> flags) throws IOException; EnumSet<CacheFlag> flags) throws IOException;
/** /**
@ -1221,7 +1181,7 @@ public interface ClientProtocol {
* @throws IOException if the directive could not be modified * @throws IOException if the directive could not be modified
*/ */
@AtMostOnce @AtMostOnce
public void modifyCacheDirective(CacheDirectiveInfo directive, void modifyCacheDirective(CacheDirectiveInfo directive,
EnumSet<CacheFlag> flags) throws IOException; EnumSet<CacheFlag> flags) throws IOException;
/** /**
@ -1231,7 +1191,7 @@ public interface ClientProtocol {
* @throws IOException if the cache directive could not be removed * @throws IOException if the cache directive could not be removed
*/ */
@AtMostOnce @AtMostOnce
public void removeCacheDirective(long id) throws IOException; void removeCacheDirective(long id) throws IOException;
/** /**
* List the set of cached paths of a cache pool. Incrementally fetches results * List the set of cached paths of a cache pool. Incrementally fetches results
@ -1244,7 +1204,7 @@ public interface ClientProtocol {
* @return A batch of CacheDirectiveEntry objects. * @return A batch of CacheDirectiveEntry objects.
*/ */
@Idempotent @Idempotent
public BatchedEntries<CacheDirectiveEntry> listCacheDirectives( BatchedEntries<CacheDirectiveEntry> listCacheDirectives(
long prevId, CacheDirectiveInfo filter) throws IOException; long prevId, CacheDirectiveInfo filter) throws IOException;
/** /**
@ -1254,7 +1214,7 @@ public interface ClientProtocol {
* @throws IOException If the request could not be completed. * @throws IOException If the request could not be completed.
*/ */
@AtMostOnce @AtMostOnce
public void addCachePool(CachePoolInfo info) throws IOException; void addCachePool(CachePoolInfo info) throws IOException;
/** /**
* Modify an existing cache pool. * Modify an existing cache pool.
@ -1265,7 +1225,7 @@ public interface ClientProtocol {
* If the request could not be completed. * If the request could not be completed.
*/ */
@AtMostOnce @AtMostOnce
public void modifyCachePool(CachePoolInfo req) throws IOException; void modifyCachePool(CachePoolInfo req) throws IOException;
/** /**
* Remove a cache pool. * Remove a cache pool.
@ -1275,17 +1235,17 @@ public interface ClientProtocol {
* removed. * removed.
*/ */
@AtMostOnce @AtMostOnce
public void removeCachePool(String pool) throws IOException; void removeCachePool(String pool) throws IOException;
/** /**
* List the set of cache pools. Incrementally fetches results from the server. * List the set of cache pools. Incrementally fetches results from the server.
* *
* @param prevPool name of the last pool listed, or the empty string if this is * @param prevPool name of the last pool listed, or the empty string if this
* the first invocation of listCachePools * is the first invocation of listCachePools
* @return A batch of CachePoolEntry objects. * @return A batch of CachePoolEntry objects.
*/ */
@Idempotent @Idempotent
public BatchedEntries<CachePoolEntry> listCachePools(String prevPool) BatchedEntries<CachePoolEntry> listCachePools(String prevPool)
throws IOException; throws IOException;
/** /**
@ -1295,7 +1255,7 @@ public interface ClientProtocol {
* changes. (Modifications are merged into the current ACL.) * changes. (Modifications are merged into the current ACL.)
*/ */
@Idempotent @Idempotent
public void modifyAclEntries(String src, List<AclEntry> aclSpec) void modifyAclEntries(String src, List<AclEntry> aclSpec)
throws IOException; throws IOException;
/** /**
@ -1303,14 +1263,14 @@ public interface ClientProtocol {
* retained. * retained.
*/ */
@Idempotent @Idempotent
public void removeAclEntries(String src, List<AclEntry> aclSpec) void removeAclEntries(String src, List<AclEntry> aclSpec)
throws IOException; throws IOException;
/** /**
* Removes all default ACL entries from files and directories. * Removes all default ACL entries from files and directories.
*/ */
@Idempotent @Idempotent
public void removeDefaultAcl(String src) throws IOException; void removeDefaultAcl(String src) throws IOException;
/** /**
* Removes all but the base ACL entries of files and directories. The entries * Removes all but the base ACL entries of files and directories. The entries
@ -1318,33 +1278,33 @@ public interface ClientProtocol {
* bits. * bits.
*/ */
@Idempotent @Idempotent
public void removeAcl(String src) throws IOException; void removeAcl(String src) throws IOException;
/** /**
* Fully replaces ACL of files and directories, discarding all existing * Fully replaces ACL of files and directories, discarding all existing
* entries. * entries.
*/ */
@Idempotent @Idempotent
public void setAcl(String src, List<AclEntry> aclSpec) throws IOException; void setAcl(String src, List<AclEntry> aclSpec) throws IOException;
/** /**
* Gets the ACLs of files and directories. * Gets the ACLs of files and directories.
*/ */
@Idempotent @Idempotent
public AclStatus getAclStatus(String src) throws IOException; AclStatus getAclStatus(String src) throws IOException;
/** /**
* Create an encryption zone * Create an encryption zone.
*/ */
@AtMostOnce @AtMostOnce
public void createEncryptionZone(String src, String keyName) void createEncryptionZone(String src, String keyName)
throws IOException; throws IOException;
/** /**
* Get the encryption zone for a path. * Get the encryption zone for a path.
*/ */
@Idempotent @Idempotent
public EncryptionZone getEZForPath(String src) EncryptionZone getEZForPath(String src)
throws IOException; throws IOException;
/** /**
@ -1355,7 +1315,7 @@ public interface ClientProtocol {
* @return Batch of encryption zones. * @return Batch of encryption zones.
*/ */
@Idempotent @Idempotent
public BatchedEntries<EncryptionZone> listEncryptionZones( BatchedEntries<EncryptionZone> listEncryptionZones(
long prevId) throws IOException; long prevId) throws IOException;
/** /**
@ -1371,7 +1331,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@AtMostOnce @AtMostOnce
public void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag) void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag)
throws IOException; throws IOException;
/** /**
@ -1388,7 +1348,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public List<XAttr> getXAttrs(String src, List<XAttr> xAttrs) List<XAttr> getXAttrs(String src, List<XAttr> xAttrs)
throws IOException; throws IOException;
/** /**
@ -1403,7 +1363,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@Idempotent @Idempotent
public List<XAttr> listXAttrs(String src) List<XAttr> listXAttrs(String src)
throws IOException; throws IOException;
/** /**
@ -1418,7 +1378,7 @@ public interface ClientProtocol {
* @throws IOException * @throws IOException
*/ */
@AtMostOnce @AtMostOnce
public void removeXAttr(String src, XAttr xAttr) throws IOException; void removeXAttr(String src, XAttr xAttr) throws IOException;
/** /**
* Checks if the user can access a path. The mode specifies which access * Checks if the user can access a path. The mode specifies which access
@ -1436,7 +1396,7 @@ public interface ClientProtocol {
* @throws IOException see specific implementation * @throws IOException see specific implementation
*/ */
@Idempotent @Idempotent
public void checkAccess(String path, FsAction mode) throws IOException; void checkAccess(String path, FsAction mode) throws IOException;
/** /**
* Get the highest txid the NameNode knows has been written to the edit * Get the highest txid the NameNode knows has been written to the edit
@ -1444,12 +1404,12 @@ public interface ClientProtocol {
* the starting point for the inotify event stream. * the starting point for the inotify event stream.
*/ */
@Idempotent @Idempotent
public long getCurrentEditLogTxid() throws IOException; long getCurrentEditLogTxid() throws IOException;
/** /**
* Get an ordered list of batches of events corresponding to the edit log * Get an ordered list of batches of events corresponding to the edit log
* transactions for txids equal to or greater than txid. * transactions for txids equal to or greater than txid.
*/ */
@Idempotent @Idempotent
public EventBatchList getEditsFromTxid(long txid) throws IOException; EventBatchList getEditsFromTxid(long txid) throws IOException;
} }

View File

@ -362,6 +362,15 @@ Release 2.8.0 - UNRELEASED
HDFS-8709. Clarify automatic sync in FSEditLog#logEdit. (wang) HDFS-8709. Clarify automatic sync in FSEditLog#logEdit. (wang)
<<<<<<< HEAD
=======
HDFS-8711. setSpaceQuota command should print the available storage type
when input storage type is wrong. (Brahma Reddy Battula via xyao)
HDFS-8620. Clean up the checkstyle warinings about ClientProtocol.
(Takanobu Asanuma via wheat9)
>>>>>>> c0b8e4e... HDFS-8620. Clean up the checkstyle warinings about ClientProtocol. Contributed by Takanobu Asanuma.
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than