diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsClientConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsClientConfigKeys.java index beed4eb3b77..9146057da9b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsClientConfigKeys.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsClientConfigKeys.java @@ -43,7 +43,8 @@ public interface HdfsClientConfigKeys { String DFS_NAMENODE_HTTP_PORT_KEY = "dfs.http.port"; String DFS_NAMENODE_HTTPS_PORT_KEY = "dfs.https.port"; 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 */ interface Retry { diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java index aa94b5bd46b..b70d4dc5684 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java @@ -77,32 +77,33 @@ public interface ClientProtocol { /** * Until version 69, this class ClientProtocol served as both - * the client interface to the NN AND the RPC protocol used to + * the client interface to the NN AND the RPC protocol used to * communicate with the NN. - * - * This class is used by both the DFSClient and the + * + * This class is used by both the DFSClient and the * NN server side to insulate from the protocol serialization. - * - * If you are adding/changing this interface then you need to + * + * If you are adding/changing this interface then you need to * change both this class and ALSO related protocol buffer * wire protocol definition in ClientNamenodeProtocol.proto. - * - * For more details on protocol buffer wire protocol, please see + * + * For more details on protocol buffer wire protocol, please see * .../org/apache/hadoop/hdfs/protocolPB/overview.html - * + * * The log of historical changes can be retrieved from the svn). * 69: Eliminate overloaded method names. - * + * * 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 /////////////////////////////////////// /** - * 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 * the proximity to the client. *
@@ -111,9 +112,9 @@ public interface ClientProtocol { * DataNode locations for each block are sorted by * the distance to the client's address. *
- * The client will then have to contact + * The client will then have to contact * one of the indicated DataNodes to obtain the actual data. - * + * * @param src file name * @param offset range start offset * @param length range length @@ -126,11 +127,8 @@ public interface ClientProtocol { * @throws IOException If an I/O error occurred */ @Idempotent - public LocatedBlocks getBlockLocations(String src, - long offset, - long length) - throws AccessControlException, FileNotFoundException, - UnresolvedLinkException, IOException; + LocatedBlocks getBlockLocations(String src, long offset, long length) + throws IOException; /** * Get server default values for a number of configuration params. @@ -138,7 +136,7 @@ public interface ClientProtocol { * @throws IOException */ @Idempotent - public FsServerDefaults getServerDefaults() throws IOException; + FsServerDefaults getServerDefaults() throws IOException; /** * Create a new file entry in the namespace. @@ -148,36 +146,36 @@ public interface ClientProtocol { * The name-node does not have a notion of "current" directory for a client. *
* Once created, the file is visible and available for read to other clients. - * Although, other clients cannot {@link #delete(String, boolean)}, re-create or - * {@link #rename(String, String)} it until the file is completed + * Although, other clients cannot {@link #delete(String, boolean)}, re-create + * or {@link #rename(String, String)} it until the file is completed * or explicitly as a result of lease expiration. *
* Blocks have a maximum size. Clients that intend to create
- * multi-block files must also use
+ * multi-block files must also use
* {@link #addBlock}
*
* @param src path of the file being created.
* @param masked masked permission.
* @param clientName name of the current client.
- * @param flag indicates whether the file should be
+ * @param flag indicates whether the file should be
* overwritten if it already exists or create if it does not exist or append.
* @param createParent create missing parent directory if true
* @param replication block replication factor.
* @param blockSize maximum block size.
* @param supportedVersions CryptoProtocolVersions supported by the client
- *
+ *
* @return the status of the created file, it could be null if the server
* doesn't support returning the file status
* @throws AccessControlException If access is denied
* @throws AlreadyBeingCreatedException if the path does not exist.
- * @throws DSQuotaExceededException If file creation violates disk space
+ * @throws DSQuotaExceededException If file creation violates disk space
* quota restriction
* @throws FileAlreadyExistsException If file
* The NameNode sets replication to the new value and returns.
- * The actual block replication is not expected to be performed during
- * this method call. The blocks will be populated or removed in the
+ * The actual block replication is not expected to be performed during
+ * this method call. The blocks will be populated or removed in the
* background as the result of the routine block maintenance procedures.
- *
+ *
* @param src file name
* @param replication new replication
- *
+ *
* @return true if successful;
* false if file does not exist or is a directory
*
* @throws AccessControlException If access is denied
- * @throws DSQuotaExceededException If replication violates disk space
+ * @throws DSQuotaExceededException If replication violates disk space
* quota restriction
* @throws FileNotFoundException If file
* Without OVERWRITE option, rename fails if the dst already exists.
- * With OVERWRITE option, rename overwrites the dst, if it is a file
+ * With OVERWRITE option, rename overwrites the dst, if it is a file
* or an empty directory. Rename fails if dst is a non-empty directory.
*
* This implementation of rename is atomic.
@@ -499,17 +481,17 @@ public interface ClientProtocol {
* @param src existing file or directory name.
* @param dst new name.
* @param options Rename options
- *
+ *
* @throws AccessControlException If access is denied
- * @throws DSQuotaExceededException If rename violates disk space
+ * @throws DSQuotaExceededException If rename violates disk space
* quota restriction
* @throws FileAlreadyExistsException If
- * same as delete but provides a way to avoid accidentally
- * deleting non empty directories programmatically.
+ * same as delete but provides a way to avoid accidentally
+ * deleting non empty directories programmatically.
* @param src existing name
* @param recursive if true deletes a non empty directory recursively,
* else throws an exception.
- * @return true only if the existing file or directory was actually removed
+ * @return true only if the existing file or directory was actually removed
* from the file system.
- *
+ *
* @throws AccessControlException If access is denied
* @throws FileNotFoundException If file
* Safe mode is entered automatically at name node startup.
* 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)}.
*
* At startup the name node accepts data node reports collecting
* information about block locations.
* In order to leave safe mode it needs to collect a configurable
- * percentage called threshold of blocks, which satisfy the minimal
+ * percentage called threshold of blocks, which satisfy the minimal
* replication condition.
* The minimal replication condition is that each block must have at least
* dfs.namenode.replication.min replicas.
@@ -760,37 +732,40 @@ public interface ClientProtocol {
* Then the name node leaves safe mode.
*
* 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
- * 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
- * {@link #setSafeMode(HdfsConstants.SafeModeAction,boolean) setSafeMode(SafeModeAction.SAFEMODE_GET,false)}
+ * {@link #setSafeMode(HdfsConstants.SafeModeAction,boolean)
+ * setSafeMode(SafeModeAction.SAFEMODE_GET,false)}
*
* sets flag to enable restore of failed storage replicas
- *
+ *
* @throws AccessControlException if the superuser privilege is violated.
*/
@Idempotent
- public boolean restoreFailedStorage(String arg)
- throws AccessControlException, IOException;
+ boolean restoreFailedStorage(String arg) throws IOException;
/**
- * Tells the namenode to reread the hosts and exclude files.
+ * Tells the namenode to reread the hosts and exclude files.
* @throws IOException
*/
@Idempotent
- public void refreshNodes() throws IOException;
+ void refreshNodes() throws IOException;
/**
* Finalize previous upgrade.
* Remove file system state saved during the upgrade.
* The upgrade will become irreversible.
- *
+ *
* @throws IOException
*/
@Idempotent
- public void finalizeUpgrade() throws IOException;
+ void finalizeUpgrade() throws IOException;
/**
* Rolling upgrade operations.
@@ -852,7 +825,7 @@ public interface ClientProtocol {
* progress, returns null.
*/
@Idempotent
- public RollingUpgradeInfo rollingUpgrade(RollingUpgradeAction action)
+ RollingUpgradeInfo rollingUpgrade(RollingUpgradeAction action)
throws IOException;
/**
@@ -866,9 +839,9 @@ public interface ClientProtocol {
* cookie returned from the previous call.
*/
@Idempotent
- public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
+ CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
throws IOException;
-
+
/**
* Dumps namenode data structures into specified file. If the file
* already exists, then append.
@@ -876,7 +849,7 @@ public interface ClientProtocol {
* @throws IOException
*/
@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
@@ -886,8 +859,8 @@ public interface ClientProtocol {
* @throws IOException
*/
@Idempotent
- public void setBalancerBandwidth(long bandwidth) throws IOException;
-
+ void setBalancerBandwidth(long bandwidth) throws IOException;
+
/**
* Get the file info for a specific file or directory.
* @param src The string representation of the path to the file
@@ -896,29 +869,27 @@ public interface ClientProtocol {
* or null if file not found
* @throws AccessControlException permission denied
* @throws FileNotFoundException file src
already exists
* @throws FileNotFoundException If parent of src
does not exist
* and createParent
is false
* @throws ParentNotDirectoryException If parent of src
is not a
* directory.
- * @throws NSQuotaExceededException If file creation violates name space
+ * @throws NSQuotaExceededException If file creation violates name space
* quota restriction
* @throws SafeModeException create not allowed in safemode
* @throws UnresolvedLinkException If src
contains a symlink
@@ -190,33 +188,29 @@ public interface ClientProtocol {
* Note that create with {@link CreateFlag#OVERWRITE} is idempotent.
*/
@AtMostOnce
- public HdfsFileStatus create(String src, FsPermission masked,
+ HdfsFileStatus create(String src, FsPermission masked,
String clientName, EnumSetWritablesrc
is not found
- * @throws DSQuotaExceededException If append violates disk space quota
+ * @throws DSQuotaExceededException If append violates disk space quota
* restriction
* @throws SafeModeException append not allowed in safemode
* @throws UnresolvedLinkException If src
contains a symlink
@@ -227,27 +221,25 @@ public interface ClientProtocol {
* @throws UnsupportedOperationException if append is not supported
*/
@AtMostOnce
- public LastBlockWithStatus append(String src, String clientName,
- EnumSetWritablesrc
is not found
* @throws SafeModeException not allowed in safemode
@@ -256,21 +248,19 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public boolean setReplication(String src, short replication)
- throws AccessControlException, DSQuotaExceededException,
- FileNotFoundException, SafeModeException, UnresolvedLinkException,
- SnapshotAccessControlException, IOException;
+ boolean setReplication(String src, short replication)
+ throws IOException;
/**
* Get all the available block storage policies.
* @return All the in-use block storage policies currently.
*/
@Idempotent
- public BlockStoragePolicy[] getStoragePolicies() throws IOException;
+ BlockStoragePolicy[] getStoragePolicies() throws IOException;
/**
- * Set the storage policy for a file/directory
- * @param src Path of an existing file/directory.
+ * Set the storage policy for a file/directory.
+ * @param src Path of an existing file/directory.
* @param policyName The name of the storage policy
* @throws SnapshotAccessControlException If access is denied
* @throws UnresolvedLinkException if src
contains a symlink
@@ -278,13 +268,12 @@ public interface ClientProtocol {
* @throws QuotaExceededException If changes violate the quota restriction
*/
@Idempotent
- public void setStoragePolicy(String src, String policyName)
- throws SnapshotAccessControlException, UnresolvedLinkException,
- FileNotFoundException, QuotaExceededException, IOException;
+ void setStoragePolicy(String src, String policyName)
+ throws IOException;
/**
* Set permissions for an existing file/directory.
- *
+ *
* @throws AccessControlException If access is denied
* @throws FileNotFoundException If file src
is not found
* @throws SafeModeException not allowed in safemode
@@ -293,9 +282,8 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public void setPermission(String src, FsPermission permission)
- throws AccessControlException, FileNotFoundException, SafeModeException,
- UnresolvedLinkException, SnapshotAccessControlException, IOException;
+ void setPermission(String src, FsPermission permission)
+ throws IOException;
/**
* Set Owner of a path (i.e. a file or a directory).
@@ -312,16 +300,15 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public void setOwner(String src, String username, String groupname)
- throws AccessControlException, FileNotFoundException, SafeModeException,
- UnresolvedLinkException, SnapshotAccessControlException, IOException;
+ void setOwner(String src, String username, String groupname)
+ throws IOException;
/**
* The client can give up on a block by calling abandonBlock().
- * The client can then either obtain a new block, or complete or abandon the
+ * The client can then either obtain a new block, or complete or abandon the
* file.
* Any partial writes to the block will be discarded.
- *
+ *
* @param b Block to abandon
* @param fileId The id of the file where the block resides. Older clients
* will pass GRANDFATHER_INODE_ID here.
@@ -334,19 +321,18 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public void abandonBlock(ExtendedBlock b, long fileId,
+ void abandonBlock(ExtendedBlock b, long fileId,
String src, String holder)
- throws AccessControlException, FileNotFoundException,
- UnresolvedLinkException, IOException;
+ throws IOException;
/**
- * A client that wants to write an additional block to the
+ * A client that wants to write an additional block to the
* indicated filename (which must currently be open for writing)
- * should call addBlock().
+ * should call addBlock().
*
* addBlock() allocates a new block and datanodes the block data
* should be replicated to.
- *
+ *
* addBlock() also commits the previous block by reporting
* to the name-node the actual generation stamp and the length
* of the block that the client has transmitted to data-nodes.
@@ -372,16 +358,14 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public LocatedBlock addBlock(String src, String clientName,
- ExtendedBlock previous, DatanodeInfo[] excludeNodes, long fileId,
+ LocatedBlock addBlock(String src, String clientName,
+ ExtendedBlock previous, DatanodeInfo[] excludeNodes, long fileId,
String[] favoredNodes)
- throws AccessControlException, FileNotFoundException,
- NotReplicatedYetException, SafeModeException, UnresolvedLinkException,
- IOException;
+ throws IOException;
- /**
+ /**
* Get a datanode for an existing pipeline.
- *
+ *
* @param src the file being written
* @param fileId the ID of the file being written
* @param blk the block being written
@@ -389,9 +373,9 @@ public interface ClientProtocol {
* @param excludes the excluded nodes
* @param numAdditionalNodes number of additional datanodes
* @param clientName the name of the client
- *
+ *
* @return the located block.
- *
+ *
* @throws AccessControlException If access is denied
* @throws FileNotFoundException If file src
is not found
* @throws SafeModeException create not allowed in safemode
@@ -399,22 +383,21 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public LocatedBlock getAdditionalDatanode(final String src,
+ LocatedBlock getAdditionalDatanode(final String src,
final long fileId, final ExtendedBlock blk,
final DatanodeInfo[] existings,
final String[] existingStorageIDs,
final DatanodeInfo[] excludes,
final int numAdditionalNodes, final String clientName
- ) throws AccessControlException, FileNotFoundException,
- SafeModeException, UnresolvedLinkException, IOException;
+ ) throws IOException;
/**
- * The client is done writing data to the given filename, and would
- * like to complete it.
+ * The client is done writing data to the given filename, and would
+ * like to complete it.
*
* The function returns whether the file has been closed successfully.
* If the function returns false, the caller should try again.
- *
+ *
* close() also commits the last block of file by reporting
* to the name-node the actual generation stamp and the length
* of the block that the client has transmitted to data-nodes.
@@ -434,14 +417,13 @@ public interface ClientProtocol {
* @throws AccessControlException If access is denied
* @throws FileNotFoundException If file src
is not found
* @throws SafeModeException create not allowed in safemode
- * @throws UnresolvedLinkException If src
contains a symlink
+ * @throws UnresolvedLinkException If src
contains a symlink
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public boolean complete(String src, String clientName,
+ boolean complete(String src, String clientName,
ExtendedBlock last, long fileId)
- throws AccessControlException, FileNotFoundException, SafeModeException,
- UnresolvedLinkException, IOException;
+ throws IOException;
/**
* 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
*/
@Idempotent
- public void reportBadBlocks(LocatedBlock[] blocks) throws IOException;
+ void reportBadBlocks(LocatedBlock[] blocks) throws IOException;
///////////////////////////////////////
// Namespace management
@@ -460,17 +442,17 @@ public interface ClientProtocol {
* @param dst new name.
* @return true if successful, or false if the old name does not exist
* or if the new name already belongs to the namespace.
- *
+ *
* @throws SnapshotAccessControlException if path is in RO snapshot
- * @throws IOException an I/O error occurred
+ * @throws IOException an I/O error occurred
*/
@AtMostOnce
- public boolean rename(String src, String dst)
- throws UnresolvedLinkException, SnapshotAccessControlException, IOException;
+ boolean rename(String src, String dst)
+ 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 srcs - list of existing files (same block size, same replication)
* @throws IOException if some arguments are invalid
@@ -479,8 +461,8 @@ public interface ClientProtocol {
* @throws SnapshotAccessControlException if path is in RO snapshot
*/
@AtMostOnce
- public void concat(String trg, String[] srcs)
- throws IOException, UnresolvedLinkException, SnapshotAccessControlException;
+ void concat(String trg, String[] srcs)
+ throws IOException;
/**
* Rename src to dst.
@@ -491,7 +473,7 @@ public interface ClientProtocol {
*
* dst
already exists and
- * options has {@link Rename#OVERWRITE} option
+ *
options
has {@link Rename#OVERWRITE} option
* false.
* @throws FileNotFoundException If src
does not exist
- * @throws NSQuotaExceededException If rename violates namespace
+ * @throws NSQuotaExceededException If rename violates namespace
* quota restriction
- * @throws ParentNotDirectoryException If parent of dst
+ * @throws ParentNotDirectoryException If parent of dst
* is not a directory
* @throws SafeModeException rename not allowed in safemode
* @throws UnresolvedLinkException If src
or
@@ -518,11 +500,8 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred
*/
@AtMostOnce
- public void rename2(String src, String dst, Options.Rename... options)
- throws AccessControlException, DSQuotaExceededException,
- FileAlreadyExistsException, FileNotFoundException,
- NSQuotaExceededException, ParentNotDirectoryException, SafeModeException,
- UnresolvedLinkException, SnapshotAccessControlException, IOException;
+ void rename2(String src, String dst, Options.Rename... options)
+ throws IOException;
/**
* Truncate file src to new size.
@@ -550,21 +529,20 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public boolean truncate(String src, long newLength, String clientName)
- throws AccessControlException, FileNotFoundException, SafeModeException,
- UnresolvedLinkException, SnapshotAccessControlException, IOException;
+ boolean truncate(String src, long newLength, String clientName)
+ throws IOException;
/**
* Delete the given file or directory from the file system.
* src
is not found
* @throws SafeModeException create not allowed in safemode
@@ -573,10 +551,9 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred
*/
@AtMostOnce
- public boolean delete(String src, boolean recursive)
- throws AccessControlException, FileNotFoundException, SafeModeException,
- UnresolvedLinkException, SnapshotAccessControlException, IOException;
-
+ boolean delete(String src, boolean recursive)
+ throws IOException;
+
/**
* Create a directory (or hierarchy of directories) with the given
* name and permission.
@@ -591,8 +568,9 @@ public interface ClientProtocol {
* @throws FileAlreadyExistsException If src
already exists
* @throws FileNotFoundException If parent of src
does not exist
* and createParent
is false
- * @throws NSQuotaExceededException If file creation violates quota restriction
- * @throws ParentNotDirectoryException If parent of src
+ * @throws NSQuotaExceededException If file creation violates quota
+ * restriction
+ * @throws ParentNotDirectoryException If parent of src
* is not a directory
* @throws SafeModeException create not allowed in safemode
* @throws UnresolvedLinkException If src
contains a symlink
@@ -603,14 +581,11 @@ public interface ClientProtocol {
* @throws InvalidPathException If src
is invalid
*/
@Idempotent
- public boolean mkdirs(String src, FsPermission masked, boolean createParent)
- throws AccessControlException, FileAlreadyExistsException,
- FileNotFoundException, NSQuotaExceededException,
- ParentNotDirectoryException, SafeModeException, UnresolvedLinkException,
- SnapshotAccessControlException, IOException;
+ boolean mkdirs(String src, FsPermission masked, boolean createParent)
+ throws IOException;
/**
- * Get a partial listing of the indicated directory
+ * Get a partial listing of the indicated directory.
*
* @param src the directory name
* @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
*/
@Idempotent
- public DirectoryListing getListing(String src,
- byte[] startAfter,
- boolean needLocation)
- throws AccessControlException, FileNotFoundException,
- UnresolvedLinkException, IOException;
-
+ DirectoryListing getListing(String src, byte[] startAfter,
+ boolean needLocation) throws IOException;
+
/**
- * Get listing of all the snapshottable directories
- *
+ * Get listing of all the snapshottable directories.
+ *
* @return Information about all the current snapshottable directory
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public SnapshottableDirectoryStatus[] getSnapshottableDirListing()
+ SnapshottableDirectoryStatus[] getSnapshottableDirListing()
throws IOException;
///////////////////////////////////////
@@ -646,7 +618,7 @@ public interface ClientProtocol {
/**
* Client programs can cause stateful changes in the NameNode
- * that affect other clients. A client may obtain a file and
+ * that affect other clients. A client may obtain a file and
* neither abandon nor complete it. A client might hold a series
* of locks that prevent other clients from proceeding.
* Clearly, it would be bad if a client held a bunch of locks
@@ -664,29 +636,28 @@ public interface ClientProtocol {
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public void renewLease(String clientName) throws AccessControlException,
- IOException;
+ void renewLease(String clientName) throws IOException;
/**
* Start lease recovery.
* Lightweight NameNode operation to trigger lease recovery
- *
+ *
* @param src path of the file to start lease recovery
* @param clientName name of the current client
* @return true if the file is already closed
* @throws IOException
*/
@Idempotent
- public boolean recoverLease(String src, String clientName) throws IOException;
+ boolean recoverLease(String src, String clientName) throws IOException;
+
+ int GET_STATS_CAPACITY_IDX = 0;
+ int GET_STATS_USED_IDX = 1;
+ int GET_STATS_REMAINING_IDX = 2;
+ int GET_STATS_UNDER_REPLICATED_IDX = 3;
+ int GET_STATS_CORRUPT_BLOCKS_IDX = 4;
+ int GET_STATS_MISSING_BLOCKS_IDX = 5;
+ int GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX = 6;
- public int GET_STATS_CAPACITY_IDX = 0;
- public int GET_STATS_USED_IDX = 1;
- public int GET_STATS_REMAINING_IDX = 2;
- public int GET_STATS_UNDER_REPLICATED_IDX = 3;
- public int GET_STATS_CORRUPT_BLOCKS_IDX = 4;
- public int GET_STATS_MISSING_BLOCKS_IDX = 5;
- public int GET_STATS_MISSING_REPL_ONE_BLOCKS_IDX = 6;
-
/**
* Get a set of statistics about the filesystem.
* Right now, only seven values are returned.
@@ -700,11 +671,11 @@ public interface ClientProtocol {
*
- *
+ *
* Configuration parameters:
* dfs.safemode.threshold.pct is the threshold parameter.
* dfs.safemode.extension is the safe mode extension parameter.
* dfs.namenode.replication.min is the minimal replication parameter.
- *
+ *
* Special cases:
- * The name node does not enter safe mode at startup if the threshold is
+ * The name node does not enter safe mode at startup if the threshold is
* set to 0 or if the name space is empty.
- * If the threshold is set to 1 then all blocks need to have at least
+ * If the threshold is set to 1 then all blocks need to have at least
* minimal replication.
- * If the threshold value is greater than 1 then the name node will not be
+ * If the threshold value is greater than 1 then the name node will not be
* able to turn off safe mode automatically.
* Safe mode can always be turned off manually.
- *
+ *
* @param action
* @param isChecked If true then action will be done only in ActiveNN.
- *
- * @return
- *
+ *
* @throws IOException
*/
@Idempotent
- public boolean setSafeMode(HdfsConstants.SafeModeAction action, boolean isChecked)
+ boolean setSafeMode(HdfsConstants.SafeModeAction action, boolean isChecked)
throws IOException;
/**
@@ -803,47 +778,45 @@ public interface ClientProtocol {
* @throws IOException if image creation failed.
*/
@AtMostOnce
- public void saveNamespace() throws AccessControlException, IOException;
+ void saveNamespace() throws IOException;
-
/**
* Roll the edit log.
* Requires superuser privileges.
- *
+ *
* @throws AccessControlException if the superuser privilege is violated
* @throws IOException if log roll fails
* @return the txid of the new segment
*/
@Idempotent
- public long rollEdits() throws AccessControlException, IOException;
+ long rollEdits() throws IOException;
/**
* Enable/Disable restore failed storage.
* src
is not found
- * @throws UnresolvedLinkException if the path contains a symlink.
- * @throws IOException If an I/O error occurred
+ * @throws UnresolvedLinkException if the path contains a symlink.
+ * @throws IOException If an I/O error occurred
*/
@Idempotent
- public HdfsFileStatus getFileInfo(String src) throws AccessControlException,
- FileNotFoundException, UnresolvedLinkException, IOException;
-
+ HdfsFileStatus getFileInfo(String src) throws 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
*
* @return return true if file is closed
* @throws AccessControlException permission denied
* @throws FileNotFoundException file src
is not found
* @throws UnresolvedLinkException if the path contains a symlink.
- * @throws IOException If an I/O error occurred
+ * @throws IOException If an I/O error occurred
*/
@Idempotent
- public boolean isFileClosed(String src) throws AccessControlException,
- FileNotFoundException, UnresolvedLinkException, IOException;
-
+ boolean isFileClosed(String src) throws 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
* refers to a symlink then the FileStatus of the symlink is returned.
* @param src The string representation of the path to the file
*
@@ -927,58 +898,55 @@ public interface ClientProtocol {
*
* @throws AccessControlException permission denied
* @throws UnresolvedLinkException if src
contains a symlink
- * @throws IOException If an I/O error occurred
+ * @throws IOException If an I/O error occurred
*/
@Idempotent
- public HdfsFileStatus getFileLinkInfo(String src)
- throws AccessControlException, UnresolvedLinkException, IOException;
-
+ HdfsFileStatus getFileLinkInfo(String src) throws IOException;
+
/**
* Get {@link ContentSummary} rooted at the specified directory.
* @param path The string representation of the path
*
* @throws AccessControlException permission denied
* @throws FileNotFoundException file path
is not found
- * @throws UnresolvedLinkException if path
contains a symlink.
+ * @throws UnresolvedLinkException if path
contains a symlink.
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public ContentSummary getContentSummary(String path)
- throws AccessControlException, FileNotFoundException,
- UnresolvedLinkException, IOException;
+ ContentSummary getContentSummary(String path) throws IOException;
/**
* Set the quota for a 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
- * @param storagespaceQuota Limit on storage space occupied all the files under
- * this directory.
+ * @param storagespaceQuota Limit on storage space occupied all the files
+ * under this directory.
* @param type StorageType that the space quota is intended to be set on.
- * It may be null when called by traditional space/namespace quota.
- * When type is is not null, the storagespaceQuota parameter is for
- * type specified and namespaceQuota must be
+ * It may be null when called by traditional space/namespace
+ * quota. When type is is not null, the storagespaceQuota
+ * parameter is for type specified and namespaceQuota must be
* {@link HdfsConstants#QUOTA_DONT_SET}.
*
*
- *
- * The quota can have three types of values : (1) 0 or more will set
+ *
+ * The quota can have three types of values : (1) 0 or more will set
* the quota to that value, (2) {@link HdfsConstants#QUOTA_DONT_SET} implies
* the quota will not be changed, and (3) {@link HdfsConstants#QUOTA_RESET}
* implies the quota will be reset. Any other value is a runtime error.
- *
+ *
* @throws AccessControlException permission denied
* @throws FileNotFoundException file path
is not found
- * @throws QuotaExceededException if the directory size
+ * @throws QuotaExceededException if the directory size
* is greater than the given quota
- * @throws UnresolvedLinkException if the path
contains a symlink.
+ * @throws UnresolvedLinkException if the path
contains
+ * a symlink.
* @throws SnapshotAccessControlException if path is in RO snapshot
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public void setQuota(String path, long namespaceQuota, long storagespaceQuota,
- StorageType type) throws AccessControlException, FileNotFoundException,
- UnresolvedLinkException, SnapshotAccessControlException, IOException;
+ void setQuota(String path, long namespaceQuota, long storagespaceQuota,
+ StorageType type) throws IOException;
/**
* Write all metadata for this file into persistent storage.
@@ -987,39 +955,35 @@ public interface ClientProtocol {
* @param inodeId The inode ID, or GRANDFATHER_INODE_ID if the client is
* too old to support fsync with inode IDs.
* @param client The string representation of the client
- * @param lastBlockLength The length of the last block (under construction)
- * to be reported to NameNode
+ * @param lastBlockLength The length of the last block (under construction)
+ * to be reported to NameNode
* @throws AccessControlException permission denied
* @throws FileNotFoundException file src
is not found
- * @throws UnresolvedLinkException if src
contains a symlink.
+ * @throws UnresolvedLinkException if src
contains a symlink.
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public void fsync(String src, long inodeId, String client,
- long lastBlockLength)
- throws AccessControlException, FileNotFoundException,
- UnresolvedLinkException, IOException;
+ void fsync(String src, long inodeId, String client, long lastBlockLength)
+ throws IOException;
/**
* Sets the modification and access time of the file to the specified time.
* @param src The string representation of the path
* @param mtime The number of milliseconds since Jan 1, 1970.
- * Setting mtime to -1 means that modification time should not be set
- * by this call.
+ * Setting mtime to -1 means that modification time should not
+ * be set by this call.
* @param atime The number of milliseconds since Jan 1, 1970.
* Setting atime to -1 means that access time should not be set
* by this call.
- *
+ *
* @throws AccessControlException permission denied
* @throws FileNotFoundException file src
is not found
- * @throws UnresolvedLinkException if src
contains a symlink.
+ * @throws UnresolvedLinkException if src
contains a symlink.
* @throws SnapshotAccessControlException if path is in RO snapshot
* @throws IOException If an I/O error occurred
*/
@Idempotent
- public void setTimes(String src, long mtime, long atime)
- throws AccessControlException, FileNotFoundException,
- UnresolvedLinkException, SnapshotAccessControlException, IOException;
+ void setTimes(String src, long mtime, long atime) throws IOException;
/**
* Create symlink to a file or directory.
@@ -1036,16 +1000,13 @@ public interface ClientProtocol {
* and createParent
is false
* @throws ParentNotDirectoryException If parent of link
is not a
* directory.
- * @throws UnresolvedLinkException if link contains a symlink.
+ * @throws UnresolvedLinkException if
link
contains a symlink.
* @throws SnapshotAccessControlException if path is in RO snapshot
* @throws IOException If an I/O error occurred
*/
@AtMostOnce
- public void createSymlink(String target, String link, FsPermission dirPerm,
- boolean createParent) throws AccessControlException,
- FileAlreadyExistsException, FileNotFoundException,
- ParentNotDirectoryException, SafeModeException, UnresolvedLinkException,
- SnapshotAccessControlException, IOException;
+ void createSymlink(String target, String link, FsPermission dirPerm,
+ boolean createParent) throws IOException;
/**
* Return the target of the given symlink. If there is an intermediate
@@ -1060,28 +1021,27 @@ public interface ClientProtocol {
* or an I/O error occurred
*/
@Idempotent
- public String getLinkTarget(String path) throws AccessControlException,
- FileNotFoundException, IOException;
-
+ String getLinkTarget(String path) throws IOException;
+
/**
- * Get a new generation stamp together with an access token for
+ * Get a new generation stamp together with an access token for
* a block under construction
- *
+ *
* This method is called only when a client needs to recover a failed
* pipeline or set up a pipeline for appending to a block.
- *
+ *
* @param block a block
* @param clientName the name of the client
* @return a located block with a new generation stamp and an access token
* @throws IOException if any error occurs
*/
@Idempotent
- public LocatedBlock updateBlockForPipeline(ExtendedBlock block,
+ LocatedBlock updateBlockForPipeline(ExtendedBlock block,
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 oldBlock the old block
* @param newBlock the new block containing new generation stamp and length
@@ -1089,104 +1049,104 @@ public interface ClientProtocol {
* @throws IOException if any error occurs
*/
@AtMostOnce
- public void updatePipeline(String clientName, ExtendedBlock oldBlock,
+ void updatePipeline(String clientName, ExtendedBlock oldBlock,
ExtendedBlock newBlock, DatanodeID[] newNodes, String[] newStorageIDs)
throws IOException;
/**
* Get a valid Delegation Token.
- *
+ *
* @param renewer the designated renewer for the token
* @return TokenXAttr
list
+ * @return ListXAttr
list
* @throws IOException
*/
@Idempotent
- public List