HADOOP-7013. Add boolean field isCorrupt to BlockLocation. Contributed by Patrick Kling.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1035923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
468579d1af
commit
fa08f4633e
|
@ -38,6 +38,9 @@ Trunk (unreleased changes)
|
||||||
HADOOP-6996. Allow CodecFactory to return a codec object given a codec'
|
HADOOP-6996. Allow CodecFactory to return a codec object given a codec'
|
||||||
class name. (hairong)
|
class name. (hairong)
|
||||||
|
|
||||||
|
HADOOP-7013. Add boolean field isCorrupt to BlockLocation.
|
||||||
|
(Patrick Kling via hairong)
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
|
|
||||||
HADOOP-6644. util.Shell getGROUPS_FOR_USER_COMMAND method name
|
HADOOP-6644. util.Shell getGROUPS_FOR_USER_COMMAND method name
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class BlockLocation implements Writable {
|
||||||
private String[] topologyPaths; // full path name in network topology
|
private String[] topologyPaths; // full path name in network topology
|
||||||
private long offset; //offset of the of the block in the file
|
private long offset; //offset of the of the block in the file
|
||||||
private long length;
|
private long length;
|
||||||
|
private boolean corrupt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
|
@ -63,6 +64,14 @@ public class BlockLocation implements Writable {
|
||||||
*/
|
*/
|
||||||
public BlockLocation(String[] names, String[] hosts, long offset,
|
public BlockLocation(String[] names, String[] hosts, long offset,
|
||||||
long length) {
|
long length) {
|
||||||
|
this(names, hosts, offset, length, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor with host, name, offset, length and corrupt flag
|
||||||
|
*/
|
||||||
|
public BlockLocation(String[] names, String[] hosts, long offset,
|
||||||
|
long length, boolean corrupt) {
|
||||||
if (names == null) {
|
if (names == null) {
|
||||||
this.names = new String[0];
|
this.names = new String[0];
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,6 +85,7 @@ public class BlockLocation implements Writable {
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
this.length = length;
|
this.length = length;
|
||||||
this.topologyPaths = new String[0];
|
this.topologyPaths = new String[0];
|
||||||
|
this.corrupt = corrupt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +93,16 @@ public class BlockLocation implements Writable {
|
||||||
*/
|
*/
|
||||||
public BlockLocation(String[] names, String[] hosts, String[] topologyPaths,
|
public BlockLocation(String[] names, String[] hosts, String[] topologyPaths,
|
||||||
long offset, long length) {
|
long offset, long length) {
|
||||||
this(names, hosts, offset, length);
|
this(names, hosts, topologyPaths, offset, length, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor with host, name, network topology, offset, length
|
||||||
|
* and corrupt flag
|
||||||
|
*/
|
||||||
|
public BlockLocation(String[] names, String[] hosts, String[] topologyPaths,
|
||||||
|
long offset, long length, boolean corrupt) {
|
||||||
|
this(names, hosts, offset, length, corrupt);
|
||||||
if (topologyPaths == null) {
|
if (topologyPaths == null) {
|
||||||
this.topologyPaths = new String[0];
|
this.topologyPaths = new String[0];
|
||||||
} else {
|
} else {
|
||||||
|
@ -139,6 +158,13 @@ public class BlockLocation implements Writable {
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the corrupt flag.
|
||||||
|
*/
|
||||||
|
public boolean isCorrupt() {
|
||||||
|
return corrupt;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the start offset of file associated with this block
|
* Set the start offset of file associated with this block
|
||||||
*/
|
*/
|
||||||
|
@ -153,6 +179,13 @@ public class BlockLocation implements Writable {
|
||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the corrupt flag.
|
||||||
|
*/
|
||||||
|
public void setCorrupt(boolean corrupt) {
|
||||||
|
this.corrupt = corrupt;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the hosts hosting this block
|
* Set the hosts hosting this block
|
||||||
*/
|
*/
|
||||||
|
@ -192,6 +225,7 @@ public class BlockLocation implements Writable {
|
||||||
public void write(DataOutput out) throws IOException {
|
public void write(DataOutput out) throws IOException {
|
||||||
out.writeLong(offset);
|
out.writeLong(offset);
|
||||||
out.writeLong(length);
|
out.writeLong(length);
|
||||||
|
out.writeBoolean(corrupt);
|
||||||
out.writeInt(names.length);
|
out.writeInt(names.length);
|
||||||
for (int i=0; i < names.length; i++) {
|
for (int i=0; i < names.length; i++) {
|
||||||
Text name = new Text(names[i]);
|
Text name = new Text(names[i]);
|
||||||
|
@ -215,6 +249,7 @@ public class BlockLocation implements Writable {
|
||||||
public void readFields(DataInput in) throws IOException {
|
public void readFields(DataInput in) throws IOException {
|
||||||
this.offset = in.readLong();
|
this.offset = in.readLong();
|
||||||
this.length = in.readLong();
|
this.length = in.readLong();
|
||||||
|
this.corrupt = in.readBoolean();
|
||||||
int numNames = in.readInt();
|
int numNames = in.readInt();
|
||||||
this.names = new String[numNames];
|
this.names = new String[numNames];
|
||||||
for (int i = 0; i < numNames; i++) {
|
for (int i = 0; i < numNames; i++) {
|
||||||
|
@ -245,6 +280,9 @@ public class BlockLocation implements Writable {
|
||||||
result.append(offset);
|
result.append(offset);
|
||||||
result.append(',');
|
result.append(',');
|
||||||
result.append(length);
|
result.append(length);
|
||||||
|
if (corrupt) {
|
||||||
|
result.append("(corrupt)");
|
||||||
|
}
|
||||||
for(String h: hosts) {
|
for(String h: hosts) {
|
||||||
result.append(',');
|
result.append(',');
|
||||||
result.append(h);
|
result.append(h);
|
||||||
|
|
Loading…
Reference in New Issue