HDFS-8218. Move classes that used by ClientProtocol into hdfs-client. Contributed by Haohui Mai.
This commit is contained in:
parent
252e69f562
commit
12f4df043f
|
@ -1,9 +1,16 @@
|
||||||
<FindBugsFilter>
|
<FindBugsFilter>
|
||||||
<Match>
|
<Match>
|
||||||
<Or>
|
<Or>
|
||||||
|
<Class name="org.apache.hadoop.fs.XAttr"/>
|
||||||
|
<Class name="org.apache.hadoop.fs.XAttr$Builder"/>
|
||||||
|
<Class name="org.apache.hadoop.hdfs.inotify.EventBatch"/>
|
||||||
<Class name="org.apache.hadoop.hdfs.protocol.HdfsFileStatus"/>
|
<Class name="org.apache.hadoop.hdfs.protocol.HdfsFileStatus"/>
|
||||||
<Class name="org.apache.hadoop.hdfs.protocol.LocatedBlock"/>
|
<Class name="org.apache.hadoop.hdfs.protocol.LocatedBlock"/>
|
||||||
|
<Class name="org.apache.hadoop.hdfs.protocol.BlockStoragePolicy"/>
|
||||||
|
<Class name="org.apache.hadoop.hdfs.protocol.CorruptFileBlocks"/>
|
||||||
|
<Class name="org.apache.hadoop.hdfs.protocol.DirectoryListing"/>
|
||||||
<Class name="org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier"/>
|
<Class name="org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier"/>
|
||||||
|
<Class name="org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey"/>
|
||||||
</Or>
|
</Or>
|
||||||
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2" />
|
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2" />
|
||||||
</Match>
|
</Match>
|
||||||
|
|
|
@ -64,54 +64,54 @@ public class XAttr {
|
||||||
SYSTEM,
|
SYSTEM,
|
||||||
RAW;
|
RAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final NameSpace ns;
|
private final NameSpace ns;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final byte[] value;
|
private final byte[] value;
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private NameSpace ns = NameSpace.USER;
|
private NameSpace ns = NameSpace.USER;
|
||||||
private String name;
|
private String name;
|
||||||
private byte[] value;
|
private byte[] value;
|
||||||
|
|
||||||
public Builder setNameSpace(NameSpace ns) {
|
public Builder setNameSpace(NameSpace ns) {
|
||||||
this.ns = ns;
|
this.ns = ns;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setName(String name) {
|
public Builder setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setValue(byte[] value) {
|
public Builder setValue(byte[] value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XAttr build() {
|
public XAttr build() {
|
||||||
return new XAttr(ns, name, value);
|
return new XAttr(ns, name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private XAttr(NameSpace ns, String name, byte[] value) {
|
private XAttr(NameSpace ns, String name, byte[] value) {
|
||||||
this.ns = ns;
|
this.ns = ns;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NameSpace getNameSpace() {
|
public NameSpace getNameSpace() {
|
||||||
return ns;
|
return ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getValue() {
|
public byte[] getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return new HashCodeBuilder(811, 67)
|
return new HashCodeBuilder(811, 67)
|
|
@ -154,7 +154,7 @@ public abstract class Event {
|
||||||
this.symlinkTarget = symlinkTarget;
|
this.symlinkTarget = symlinkTarget;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder overwrite(boolean overwrite) {
|
public Builder overwrite(boolean overwrite) {
|
||||||
this.overwrite = overwrite;
|
this.overwrite = overwrite;
|
||||||
return this;
|
return this;
|
||||||
|
@ -224,7 +224,7 @@ public abstract class Event {
|
||||||
public String getSymlinkTarget() {
|
public String getSymlinkTarget() {
|
||||||
return symlinkTarget;
|
return symlinkTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getOverwrite() {
|
public boolean getOverwrite() {
|
||||||
return overwrite;
|
return overwrite;
|
||||||
}
|
}
|
|
@ -123,7 +123,7 @@ public class BlockStoragePolicy {
|
||||||
* Choose the storage types for storing the remaining replicas, given the
|
* Choose the storage types for storing the remaining replicas, given the
|
||||||
* replication number, the storage types of the chosen replicas and
|
* replication number, the storage types of the chosen replicas and
|
||||||
* the unavailable storage types. It uses fallback storage in case that
|
* the unavailable storage types. It uses fallback storage in case that
|
||||||
* the desired storage type is unavailable.
|
* the desired storage type is unavailable.
|
||||||
*
|
*
|
||||||
* @param replication the replication number.
|
* @param replication the replication number.
|
||||||
* @param chosen the storage types of the chosen replicas.
|
* @param chosen the storage types of the chosen replicas.
|
|
@ -61,7 +61,7 @@ public class CorruptFileBlocks {
|
||||||
Arrays.equals(files, other.files);
|
Arrays.equals(files, other.files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = cookie.hashCode();
|
int result = cookie.hashCode();
|
|
@ -28,13 +28,13 @@ import org.apache.hadoop.classification.InterfaceStability;
|
||||||
public class DirectoryListing {
|
public class DirectoryListing {
|
||||||
private HdfsFileStatus[] partialListing;
|
private HdfsFileStatus[] partialListing;
|
||||||
private int remainingEntries;
|
private int remainingEntries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
* @param partialListing a partial listing of a directory
|
* @param partialListing a partial listing of a directory
|
||||||
* @param remainingEntries number of entries that are left to be listed
|
* @param remainingEntries number of entries that are left to be listed
|
||||||
*/
|
*/
|
||||||
public DirectoryListing(HdfsFileStatus[] partialListing,
|
public DirectoryListing(HdfsFileStatus[] partialListing,
|
||||||
int remainingEntries) {
|
int remainingEntries) {
|
||||||
if (partialListing == null) {
|
if (partialListing == null) {
|
||||||
throw new IllegalArgumentException("partial listing should not be null");
|
throw new IllegalArgumentException("partial listing should not be null");
|
||||||
|
@ -54,7 +54,7 @@ public class DirectoryListing {
|
||||||
public HdfsFileStatus[] getPartialListing() {
|
public HdfsFileStatus[] getPartialListing() {
|
||||||
return partialListing;
|
return partialListing;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of remaining entries that are left to be listed
|
* Get the number of remaining entries that are left to be listed
|
||||||
* @return the number of remaining entries that are left to be listed
|
* @return the number of remaining entries that are left to be listed
|
||||||
|
@ -62,7 +62,7 @@ public class DirectoryListing {
|
||||||
public int getRemainingEntries() {
|
public int getRemainingEntries() {
|
||||||
return remainingEntries;
|
return remainingEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if there are more entries that are left to be listed
|
* Check if there are more entries that are left to be listed
|
||||||
* @return true if there are more entries that are left to be listed;
|
* @return true if there are more entries that are left to be listed;
|
||||||
|
@ -71,7 +71,7 @@ public class DirectoryListing {
|
||||||
public boolean hasMore() {
|
public boolean hasMore() {
|
||||||
return remainingEntries != 0;
|
return remainingEntries != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last name in this list
|
* Get the last name in this list
|
||||||
* @return the last name in the list if it is not empty; otherwise return null
|
* @return the last name in the list if it is not empty; otherwise return null
|
|
@ -25,15 +25,15 @@ import org.apache.hadoop.classification.InterfaceStability;
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public final class NSQuotaExceededException extends QuotaExceededException {
|
public final class NSQuotaExceededException extends QuotaExceededException {
|
||||||
protected static final long serialVersionUID = 1L;
|
protected static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String prefix;
|
private String prefix;
|
||||||
|
|
||||||
public NSQuotaExceededException() {}
|
public NSQuotaExceededException() {}
|
||||||
|
|
||||||
public NSQuotaExceededException(String msg) {
|
public NSQuotaExceededException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NSQuotaExceededException(long quota, long count) {
|
public NSQuotaExceededException(long quota, long count) {
|
||||||
super(quota, count);
|
super(quota, count);
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,9 @@ public final class NSQuotaExceededException extends QuotaExceededException {
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
String msg = super.getMessage();
|
String msg = super.getMessage();
|
||||||
if (msg == null) {
|
if (msg == null) {
|
||||||
msg = "The NameSpace quota (directories and files)" +
|
msg = "The NameSpace quota (directories and files)" +
|
||||||
(pathName==null?"":(" of directory " + pathName)) +
|
(pathName==null?"":(" of directory " + pathName)) +
|
||||||
" is exceeded: quota=" + quota + " file count=" + count;
|
" is exceeded: quota=" + quota + " file count=" + count;
|
||||||
|
|
||||||
if (prefix != null) {
|
if (prefix != null) {
|
||||||
msg = prefix + ": " + msg;
|
msg = prefix + ": " + msg;
|
|
@ -23,15 +23,15 @@ import java.io.IOException;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.classification.InterfaceStability;
|
import org.apache.hadoop.classification.InterfaceStability;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception is thrown when modification to HDFS results in violation
|
* This exception is thrown when modification to HDFS results in violation
|
||||||
* of a directory quota. A directory quota might be namespace quota (limit
|
* of a directory quota. A directory quota might be namespace quota (limit
|
||||||
* on number of files and directories) or a diskspace quota (limit on space
|
* on number of files and directories) or a diskspace quota (limit on space
|
||||||
* taken by all the file under the directory tree). <br> <br>
|
* taken by all the file under the directory tree). <br> <br>
|
||||||
*
|
*
|
||||||
* The message for the exception specifies the directory where the quota
|
* The message for the exception specifies the directory where the quota
|
||||||
* was violated and actual quotas. Specific message is generated in the
|
* was violated and actual quotas. Specific message is generated in the
|
||||||
* corresponding Exception class:
|
* corresponding Exception class:
|
||||||
* DSQuotaExceededException or
|
* DSQuotaExceededException or
|
||||||
* NSQuotaExceededException
|
* NSQuotaExceededException
|
||||||
*/
|
*/
|
||||||
|
@ -42,22 +42,22 @@ public class QuotaExceededException extends IOException {
|
||||||
protected String pathName=null;
|
protected String pathName=null;
|
||||||
protected long quota; // quota
|
protected long quota; // quota
|
||||||
protected long count; // actual value
|
protected long count; // actual value
|
||||||
|
|
||||||
protected QuotaExceededException() {}
|
protected QuotaExceededException() {}
|
||||||
|
|
||||||
protected QuotaExceededException(String msg) {
|
protected QuotaExceededException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected QuotaExceededException(long quota, long count) {
|
protected QuotaExceededException(long quota, long count) {
|
||||||
this.quota = quota;
|
this.quota = quota;
|
||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPathName(String path) {
|
public void setPathName(String path) {
|
||||||
this.pathName = path;
|
this.pathName = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return super.getMessage();
|
return super.getMessage();
|
|
@ -31,7 +31,7 @@ public class RollingUpgradeInfo extends RollingUpgradeStatus {
|
||||||
private final long startTime;
|
private final long startTime;
|
||||||
private long finalizeTime;
|
private long finalizeTime;
|
||||||
private boolean createdRollbackImages;
|
private boolean createdRollbackImages;
|
||||||
|
|
||||||
public RollingUpgradeInfo(String blockPoolId, boolean createdRollbackImages,
|
public RollingUpgradeInfo(String blockPoolId, boolean createdRollbackImages,
|
||||||
long startTime, long finalizeTime) {
|
long startTime, long finalizeTime) {
|
||||||
super(blockPoolId, finalizeTime != 0);
|
super(blockPoolId, finalizeTime != 0);
|
||||||
|
@ -39,7 +39,7 @@ public class RollingUpgradeInfo extends RollingUpgradeStatus {
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
this.finalizeTime = finalizeTime;
|
this.finalizeTime = finalizeTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean createdRollbackImages() {
|
public boolean createdRollbackImages() {
|
||||||
return createdRollbackImages;
|
return createdRollbackImages;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class RollingUpgradeInfo extends RollingUpgradeStatus {
|
||||||
public boolean isStarted() {
|
public boolean isStarted() {
|
||||||
return startTime != 0;
|
return startTime != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return The rolling upgrade starting time. */
|
/** @return The rolling upgrade starting time. */
|
||||||
public long getStartTime() {
|
public long getStartTime() {
|
||||||
return startTime;
|
return startTime;
|
||||||
|
@ -102,7 +102,7 @@ public class RollingUpgradeInfo extends RollingUpgradeStatus {
|
||||||
+ "\n Start Time: " + (startTime == 0? "<NOT STARTED>": timestamp2String(startTime))
|
+ "\n Start Time: " + (startTime == 0? "<NOT STARTED>": timestamp2String(startTime))
|
||||||
+ "\n Finalize Time: " + (finalizeTime == 0? "<NOT FINALIZED>": timestamp2String(finalizeTime));
|
+ "\n Finalize Time: " + (finalizeTime == 0? "<NOT FINALIZED>": timestamp2String(finalizeTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String timestamp2String(long timestamp) {
|
private static String timestamp2String(long timestamp) {
|
||||||
return new Date(timestamp) + " (=" + timestamp + ")";
|
return new Date(timestamp) + " (=" + timestamp + ")";
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@ public class DataEncryptionKey {
|
||||||
public final byte[] encryptionKey;
|
public final byte[] encryptionKey;
|
||||||
public final long expiryDate;
|
public final long expiryDate;
|
||||||
public final String encryptionAlgorithm;
|
public final String encryptionAlgorithm;
|
||||||
|
|
||||||
public DataEncryptionKey(int keyId, String blockPoolId, byte[] nonce,
|
public DataEncryptionKey(int keyId, String blockPoolId, byte[] nonce,
|
||||||
byte[] encryptionKey, long expiryDate, String encryptionAlgorithm) {
|
byte[] encryptionKey, long expiryDate, String encryptionAlgorithm) {
|
||||||
this.keyId = keyId;
|
this.keyId = keyId;
|
||||||
|
@ -41,7 +41,7 @@ public class DataEncryptionKey {
|
||||||
this.expiryDate = expiryDate;
|
this.expiryDate = expiryDate;
|
||||||
this.encryptionAlgorithm = encryptionAlgorithm;
|
this.encryptionAlgorithm = encryptionAlgorithm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return keyId + "/" + blockPoolId + "/" + nonce.length + "/" +
|
return keyId + "/" + blockPoolId + "/" + nonce.length + "/" +
|
|
@ -458,6 +458,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HDFS-8185. Separate client related routines in HAUtil into a new class.
|
HDFS-8185. Separate client related routines in HAUtil into a new class.
|
||||||
(wheat9)
|
(wheat9)
|
||||||
|
|
||||||
|
HDFS-8218. Move classes that used by ClientProtocol into hdfs-client.
|
||||||
|
(wheat9)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than
|
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than
|
||||||
|
|
Loading…
Reference in New Issue