HDFS-6276. Merge r1589586 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1589588 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b04bb049d2
commit
32e76decb5
|
@ -130,6 +130,8 @@ Release 2.5.0 - UNRELEASED
|
||||||
HDFS-6217. Webhdfs PUT operations may not work via a http proxy.
|
HDFS-6217. Webhdfs PUT operations may not work via a http proxy.
|
||||||
(Daryn Sharp via kihwal)
|
(Daryn Sharp via kihwal)
|
||||||
|
|
||||||
|
HDFS-6276. Remove unnecessary conditions and null check. (suresh)
|
||||||
|
|
||||||
Release 2.4.1 - UNRELEASED
|
Release 2.4.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -423,10 +423,8 @@ public class BlockManager {
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
try {
|
try {
|
||||||
if (replicationThread != null) {
|
replicationThread.interrupt();
|
||||||
replicationThread.interrupt();
|
replicationThread.join(3000);
|
||||||
replicationThread.join(3000);
|
|
||||||
}
|
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
}
|
}
|
||||||
datanodeManager.close();
|
datanodeManager.close();
|
||||||
|
@ -818,7 +816,7 @@ public class BlockManager {
|
||||||
for(DatanodeStorageInfo storage : blocksMap.getStorages(blk)) {
|
for(DatanodeStorageInfo storage : blocksMap.getStorages(blk)) {
|
||||||
final DatanodeDescriptor d = storage.getDatanodeDescriptor();
|
final DatanodeDescriptor d = storage.getDatanodeDescriptor();
|
||||||
final boolean replicaCorrupt = corruptReplicas.isReplicaCorrupt(blk, d);
|
final boolean replicaCorrupt = corruptReplicas.isReplicaCorrupt(blk, d);
|
||||||
if (isCorrupt || (!isCorrupt && !replicaCorrupt))
|
if (isCorrupt || (!replicaCorrupt))
|
||||||
machines[j++] = storage;
|
machines[j++] = storage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2245,7 +2243,6 @@ public class BlockManager {
|
||||||
// it will happen in next block report otherwise.
|
// it will happen in next block report otherwise.
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
assert storedBlock != null : "Block must be stored by now";
|
|
||||||
BlockCollection bc = storedBlock.getBlockCollection();
|
BlockCollection bc = storedBlock.getBlockCollection();
|
||||||
assert bc != null : "Block must belong to a file";
|
assert bc != null : "Block must belong to a file";
|
||||||
|
|
||||||
|
|
|
@ -86,8 +86,7 @@ class BlockReceiver implements Closeable {
|
||||||
private int bytesPerChecksum;
|
private int bytesPerChecksum;
|
||||||
private int checksumSize;
|
private int checksumSize;
|
||||||
|
|
||||||
private final PacketReceiver packetReceiver =
|
private final PacketReceiver packetReceiver = new PacketReceiver(false);
|
||||||
new PacketReceiver(false);
|
|
||||||
|
|
||||||
protected final String inAddr;
|
protected final String inAddr;
|
||||||
protected final String myAddr;
|
protected final String myAddr;
|
||||||
|
@ -268,10 +267,8 @@ class BlockReceiver implements Closeable {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
if (packetReceiver != null) {
|
packetReceiver.close();
|
||||||
packetReceiver.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
IOException ioe = null;
|
IOException ioe = null;
|
||||||
if (syncOnClose && (out != null || checksumOut != null)) {
|
if (syncOnClose && (out != null || checksumOut != null)) {
|
||||||
datanode.metrics.incrFsyncCount();
|
datanode.metrics.incrFsyncCount();
|
||||||
|
|
|
@ -131,8 +131,7 @@ public class DataBlockScanner implements Runnable {
|
||||||
private BlockPoolSliceScanner getNextBPScanner(String currentBpId) {
|
private BlockPoolSliceScanner getNextBPScanner(String currentBpId) {
|
||||||
|
|
||||||
String nextBpId = null;
|
String nextBpId = null;
|
||||||
while ((nextBpId == null) && datanode.shouldRun
|
while (datanode.shouldRun && !blockScannerThread.isInterrupted()) {
|
||||||
&& !blockScannerThread.isInterrupted()) {
|
|
||||||
waitForInit();
|
waitForInit();
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (getBlockPoolSetSize() > 0) {
|
if (getBlockPoolSetSize() > 0) {
|
||||||
|
|
|
@ -188,11 +188,9 @@ class RollingLogsImpl implements RollingLogs {
|
||||||
if (reader != null && (line = reader.readLine()) != null) {
|
if (reader != null && (line = reader.readLine()) != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (line == null) {
|
// move to the next file.
|
||||||
// move to the next file.
|
if (openFile()) {
|
||||||
if (openFile()) {
|
readNext();
|
||||||
readNext();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (!hasNext()) {
|
if (!hasNext()) {
|
||||||
|
|
|
@ -109,9 +109,7 @@ public final class CachePool {
|
||||||
UserGroupInformation ugi = null;
|
UserGroupInformation ugi = null;
|
||||||
String ownerName = info.getOwnerName();
|
String ownerName = info.getOwnerName();
|
||||||
if (ownerName == null) {
|
if (ownerName == null) {
|
||||||
if (ugi == null) {
|
ugi = NameNode.getRemoteUser();
|
||||||
ugi = NameNode.getRemoteUser();
|
|
||||||
}
|
|
||||||
ownerName = ugi.getShortUserName();
|
ownerName = ugi.getShortUserName();
|
||||||
}
|
}
|
||||||
String groupName = info.getGroupName();
|
String groupName = info.getGroupName();
|
||||||
|
|
|
@ -655,7 +655,7 @@ public class FSImageFormat {
|
||||||
clientName = FSImageSerialization.readString(in);
|
clientName = FSImageSerialization.readString(in);
|
||||||
clientMachine = FSImageSerialization.readString(in);
|
clientMachine = FSImageSerialization.readString(in);
|
||||||
// convert the last block to BlockUC
|
// convert the last block to BlockUC
|
||||||
if (blocks != null && blocks.length > 0) {
|
if (blocks.length > 0) {
|
||||||
BlockInfo lastBlk = blocks[blocks.length - 1];
|
BlockInfo lastBlk = blocks[blocks.length - 1];
|
||||||
blocks[blocks.length - 1] = new BlockInfoUnderConstruction(
|
blocks[blocks.length - 1] = new BlockInfoUnderConstruction(
|
||||||
lastBlk, replication);
|
lastBlk, replication);
|
||||||
|
@ -1023,7 +1023,6 @@ public class FSImageFormat {
|
||||||
if (!NameNodeLayoutVersion.supports(Feature.SNAPSHOT, layoutVersion)) {
|
if (!NameNodeLayoutVersion.supports(Feature.SNAPSHOT, layoutVersion)) {
|
||||||
if (Arrays.equals(component, HdfsConstants.DOT_SNAPSHOT_DIR_BYTES)) {
|
if (Arrays.equals(component, HdfsConstants.DOT_SNAPSHOT_DIR_BYTES)) {
|
||||||
Preconditions.checkArgument(
|
Preconditions.checkArgument(
|
||||||
renameReservedMap != null &&
|
|
||||||
renameReservedMap.containsKey(HdfsConstants.DOT_SNAPSHOT_DIR),
|
renameReservedMap.containsKey(HdfsConstants.DOT_SNAPSHOT_DIR),
|
||||||
RESERVED_ERROR_MSG);
|
RESERVED_ERROR_MSG);
|
||||||
component =
|
component =
|
||||||
|
@ -1044,7 +1043,6 @@ public class FSImageFormat {
|
||||||
if (!NameNodeLayoutVersion.supports(Feature.ADD_INODE_ID, layoutVersion)) {
|
if (!NameNodeLayoutVersion.supports(Feature.ADD_INODE_ID, layoutVersion)) {
|
||||||
if (Arrays.equals(component, FSDirectory.DOT_RESERVED)) {
|
if (Arrays.equals(component, FSDirectory.DOT_RESERVED)) {
|
||||||
Preconditions.checkArgument(
|
Preconditions.checkArgument(
|
||||||
renameReservedMap != null &&
|
|
||||||
renameReservedMap.containsKey(FSDirectory.DOT_RESERVED_STRING),
|
renameReservedMap.containsKey(FSDirectory.DOT_RESERVED_STRING),
|
||||||
RESERVED_ERROR_MSG);
|
RESERVED_ERROR_MSG);
|
||||||
final String renameString = renameReservedMap
|
final String renameString = renameReservedMap
|
||||||
|
|
|
@ -1095,9 +1095,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
stopSecretManager();
|
stopSecretManager();
|
||||||
if (leaseManager != null) {
|
leaseManager.stopMonitor();
|
||||||
leaseManager.stopMonitor();
|
|
||||||
}
|
|
||||||
if (nnrmthread != null) {
|
if (nnrmthread != null) {
|
||||||
((NameNodeResourceMonitor) nnrmthread.getRunnable()).stopMonitor();
|
((NameNodeResourceMonitor) nnrmthread.getRunnable()).stopMonitor();
|
||||||
nnrmthread.interrupt();
|
nnrmthread.interrupt();
|
||||||
|
@ -3775,20 +3773,10 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
||||||
final BlockInfo lastBlock = pendingFile.getLastBlock();
|
final BlockInfo lastBlock = pendingFile.getLastBlock();
|
||||||
BlockUCState lastBlockState = lastBlock.getBlockUCState();
|
BlockUCState lastBlockState = lastBlock.getBlockUCState();
|
||||||
BlockInfo penultimateBlock = pendingFile.getPenultimateBlock();
|
BlockInfo penultimateBlock = pendingFile.getPenultimateBlock();
|
||||||
boolean penultimateBlockMinReplication;
|
|
||||||
BlockUCState penultimateBlockState;
|
// If penultimate block doesn't exist then its minReplication is met
|
||||||
if (penultimateBlock == null) {
|
boolean penultimateBlockMinReplication = penultimateBlock == null ? true :
|
||||||
penultimateBlockState = BlockUCState.COMPLETE;
|
|
||||||
// If penultimate block doesn't exist then its minReplication is met
|
|
||||||
penultimateBlockMinReplication = true;
|
|
||||||
} else {
|
|
||||||
penultimateBlockState = BlockUCState.COMMITTED;
|
|
||||||
penultimateBlockMinReplication =
|
|
||||||
blockManager.checkMinReplication(penultimateBlock);
|
blockManager.checkMinReplication(penultimateBlock);
|
||||||
}
|
|
||||||
assert penultimateBlockState == BlockUCState.COMPLETE ||
|
|
||||||
penultimateBlockState == BlockUCState.COMMITTED :
|
|
||||||
"Unexpected state of penultimate block in " + src;
|
|
||||||
|
|
||||||
switch(lastBlockState) {
|
switch(lastBlockState) {
|
||||||
case COMPLETE:
|
case COMPLETE:
|
||||||
|
|
|
@ -435,17 +435,19 @@ public class INodeFile extends INodeWithAdditionalFields
|
||||||
removedINodes, countDiffChange);
|
removedINodes, countDiffChange);
|
||||||
}
|
}
|
||||||
Quota.Counts counts = Quota.Counts.newInstance();
|
Quota.Counts counts = Quota.Counts.newInstance();
|
||||||
if (snapshot == CURRENT_STATE_ID && priorSnapshotId == NO_SNAPSHOT_ID) {
|
if (snapshot == CURRENT_STATE_ID) {
|
||||||
// this only happens when deleting the current file and the file is not
|
if (priorSnapshotId == NO_SNAPSHOT_ID) {
|
||||||
// in any snapshot
|
// this only happens when deleting the current file and the file is not
|
||||||
computeQuotaUsage(counts, false);
|
// in any snapshot
|
||||||
destroyAndCollectBlocks(collectedBlocks, removedINodes);
|
computeQuotaUsage(counts, false);
|
||||||
} else if (snapshot == CURRENT_STATE_ID && priorSnapshotId != NO_SNAPSHOT_ID) {
|
destroyAndCollectBlocks(collectedBlocks, removedINodes);
|
||||||
// when deleting the current file and the file is in snapshot, we should
|
} else {
|
||||||
// clean the 0-sized block if the file is UC
|
// when deleting the current file and the file is in snapshot, we should
|
||||||
FileUnderConstructionFeature uc = getFileUnderConstructionFeature();
|
// clean the 0-sized block if the file is UC
|
||||||
if (uc != null) {
|
FileUnderConstructionFeature uc = getFileUnderConstructionFeature();
|
||||||
uc.cleanZeroSizeBlock(this, collectedBlocks);
|
if (uc != null) {
|
||||||
|
uc.cleanZeroSizeBlock(this, collectedBlocks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return counts;
|
return counts;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package org.apache.hadoop.hdfs.server.namenode;
|
package org.apache.hadoop.hdfs.server.namenode;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class SaveNamespaceCancelledException extends IOException {
|
public class SaveNamespaceCancelledException extends IOException {
|
||||||
|
|
Loading…
Reference in New Issue