|
@@ -1421,7 +1421,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
try {
|
|
|
lb = startFileInternal(src, null, holder, clientMachine,
|
|
|
EnumSet.of(CreateFlag.APPEND),
|
|
|
- false, blockManager.maxReplication, (long)0);
|
|
|
+ false, blockManager.maxReplication, 0);
|
|
|
} finally {
|
|
|
writeUnlock();
|
|
|
}
|
|
@@ -1504,7 +1504,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
fileLength = pendingFile.computeContentSummary().getLength();
|
|
|
blockSize = pendingFile.getPreferredBlockSize();
|
|
|
clientNode = pendingFile.getClientNode();
|
|
|
- replication = (int)pendingFile.getReplication();
|
|
|
+ replication = pendingFile.getReplication();
|
|
|
} finally {
|
|
|
writeUnlock();
|
|
|
}
|
|
@@ -2214,6 +2214,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
// If the penultimate block is not COMPLETE, then it must be COMMITTED.
|
|
|
if(nrCompleteBlocks < nrBlocks - 2 ||
|
|
|
nrCompleteBlocks == nrBlocks - 2 &&
|
|
|
+ curBlock != null &&
|
|
|
curBlock.getBlockUCState() != BlockUCState.COMMITTED) {
|
|
|
final String message = "DIR* NameSystem.internalReleaseLease: "
|
|
|
+ "attempt to release a create lock on "
|
|
@@ -2299,7 +2300,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
}
|
|
|
|
|
|
Lease reassignLeaseInternal(Lease lease, String src, String newHolder,
|
|
|
- INodeFileUnderConstruction pendingFile) throws IOException {
|
|
|
+ INodeFileUnderConstruction pendingFile) {
|
|
|
assert hasWriteLock();
|
|
|
pendingFile.setClientName(newHolder);
|
|
|
return leaseManager.reassignLease(lease, src, newHolder);
|
|
@@ -2402,7 +2403,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
newtargets[i]);
|
|
|
}
|
|
|
}
|
|
|
- if (closeFile) {
|
|
|
+ if ((closeFile) && (descriptors != null)) {
|
|
|
// the file is getting closed. Insert block locations into blockManager.
|
|
|
// Otherwise fsck will report these blocks as MISSING, especially if the
|
|
|
// blocksReceived from Datanodes take a long time to arrive.
|
|
@@ -3088,7 +3089,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
this.blockTotal = total;
|
|
|
this.blockThreshold = (int) (blockTotal * threshold);
|
|
|
this.blockReplQueueThreshold =
|
|
|
- (int) (((double) blockTotal) * replQueueThreshold);
|
|
|
+ (int) (blockTotal * replQueueThreshold);
|
|
|
checkMode();
|
|
|
}
|
|
|
|
|
@@ -3098,7 +3099,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
* @param replication current replication
|
|
|
*/
|
|
|
private synchronized void incrementSafeBlockCount(short replication) {
|
|
|
- if ((int)replication == safeReplication)
|
|
|
+ if (replication == safeReplication)
|
|
|
this.blockSafe++;
|
|
|
checkMode();
|
|
|
}
|
|
@@ -3230,6 +3231,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
/**
|
|
|
* Checks consistency of the class state.
|
|
|
* This is costly and currently called only in assert.
|
|
|
+ * @throws IOException
|
|
|
*/
|
|
|
private boolean isConsistent() throws IOException {
|
|
|
if (blockTotal == -1 && blockSafe == -1) {
|