HDFS-16370. Fix assert message for BlockInfo (#3747). Contributed by tomscut.
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
parent
2f55a6cced
commit
c2afb6a00b
|
@ -86,7 +86,7 @@ public abstract class BlockInfo extends Block
|
||||||
|
|
||||||
public BlockInfo(Block blk, short size) {
|
public BlockInfo(Block blk, short size) {
|
||||||
super(blk);
|
super(blk);
|
||||||
this.triplets = new Object[3*size];
|
this.triplets = new Object[3 * size];
|
||||||
this.bcId = INVALID_INODE_ID;
|
this.bcId = INVALID_INODE_ID;
|
||||||
this.replication = isStriped() ? 0 : size;
|
this.replication = isStriped() ? 0 : size;
|
||||||
}
|
}
|
||||||
|
@ -126,34 +126,34 @@ public abstract class BlockInfo extends Block
|
||||||
|
|
||||||
DatanodeStorageInfo getStorageInfo(int index) {
|
DatanodeStorageInfo getStorageInfo(int index) {
|
||||||
assert this.triplets != null : "BlockInfo is not initialized";
|
assert this.triplets != null : "BlockInfo is not initialized";
|
||||||
assert index >= 0 && index*3 < triplets.length : "Index is out of bound";
|
assert index >= 0 && index * 3 < triplets.length : "Index is out of bound";
|
||||||
return (DatanodeStorageInfo)triplets[index*3];
|
return (DatanodeStorageInfo)triplets[index * 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockInfo getPrevious(int index) {
|
BlockInfo getPrevious(int index) {
|
||||||
assert this.triplets != null : "BlockInfo is not initialized";
|
assert this.triplets != null : "BlockInfo is not initialized";
|
||||||
assert index >= 0 && index*3+1 < triplets.length : "Index is out of bound";
|
assert index >= 0 && index * 3 + 1 < triplets.length : "Index is out of bound";
|
||||||
BlockInfo info = (BlockInfo)triplets[index*3+1];
|
BlockInfo info = (BlockInfo)triplets[index * 3 + 1];
|
||||||
assert info == null ||
|
assert info == null ||
|
||||||
info.getClass().getName().startsWith(BlockInfo.class.getName()) :
|
info.getClass().getName().startsWith(BlockInfo.class.getName()) :
|
||||||
"BlockInfo is expected at " + index*3;
|
"BlockInfo is expected at " + (index * 3 + 1);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockInfo getNext(int index) {
|
BlockInfo getNext(int index) {
|
||||||
assert this.triplets != null : "BlockInfo is not initialized";
|
assert this.triplets != null : "BlockInfo is not initialized";
|
||||||
assert index >= 0 && index*3+2 < triplets.length : "Index is out of bound";
|
assert index >= 0 && index * 3 + 2 < triplets.length : "Index is out of bound";
|
||||||
BlockInfo info = (BlockInfo)triplets[index*3+2];
|
BlockInfo info = (BlockInfo)triplets[index * 3 + 2];
|
||||||
assert info == null || info.getClass().getName().startsWith(
|
assert info == null || info.getClass().getName().startsWith(
|
||||||
BlockInfo.class.getName()) :
|
BlockInfo.class.getName()) :
|
||||||
"BlockInfo is expected at " + index*3;
|
"BlockInfo is expected at " + (index * 3 + 2);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setStorageInfo(int index, DatanodeStorageInfo storage) {
|
void setStorageInfo(int index, DatanodeStorageInfo storage) {
|
||||||
assert this.triplets != null : "BlockInfo is not initialized";
|
assert this.triplets != null : "BlockInfo is not initialized";
|
||||||
assert index >= 0 && index*3 < triplets.length : "Index is out of bound";
|
assert index >= 0 && index * 3 < triplets.length : "Index is out of bound";
|
||||||
triplets[index*3] = storage;
|
triplets[index * 3] = storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -166,9 +166,9 @@ public abstract class BlockInfo extends Block
|
||||||
*/
|
*/
|
||||||
BlockInfo setPrevious(int index, BlockInfo to) {
|
BlockInfo setPrevious(int index, BlockInfo to) {
|
||||||
assert this.triplets != null : "BlockInfo is not initialized";
|
assert this.triplets != null : "BlockInfo is not initialized";
|
||||||
assert index >= 0 && index*3+1 < triplets.length : "Index is out of bound";
|
assert index >= 0 && index * 3 + 1 < triplets.length : "Index is out of bound";
|
||||||
BlockInfo info = (BlockInfo) triplets[index*3+1];
|
BlockInfo info = (BlockInfo) triplets[index * 3 + 1];
|
||||||
triplets[index*3+1] = to;
|
triplets[index * 3 + 1] = to;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,9 +182,9 @@ public abstract class BlockInfo extends Block
|
||||||
*/
|
*/
|
||||||
BlockInfo setNext(int index, BlockInfo to) {
|
BlockInfo setNext(int index, BlockInfo to) {
|
||||||
assert this.triplets != null : "BlockInfo is not initialized";
|
assert this.triplets != null : "BlockInfo is not initialized";
|
||||||
assert index >= 0 && index*3+2 < triplets.length : "Index is out of bound";
|
assert index >= 0 && index * 3 + 2 < triplets.length : "Index is out of bound";
|
||||||
BlockInfo info = (BlockInfo) triplets[index*3+2];
|
BlockInfo info = (BlockInfo) triplets[index * 3 + 2];
|
||||||
triplets[index*3+2] = to;
|
triplets[index * 3 + 2] = to;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue