HDFS-2330. In NNStorage.java, IOExceptions of stream closures can mask root exceptions. Contributed by Uma Maheswara Rao G.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1372599 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c6469150a8
commit
6697240114
|
@ -423,6 +423,9 @@ Release 2.0.1-alpha - UNRELEASED
|
||||||
|
|
||||||
HDFS-3758. TestFuseDFS test failing. (Colin Patrick McCabe via eli)
|
HDFS-3758. TestFuseDFS test failing. (Colin Patrick McCabe via eli)
|
||||||
|
|
||||||
|
HDFS-2330. In NNStorage.java, IOExceptions of stream closures can mask
|
||||||
|
root exceptions. (umamahesh via todd)
|
||||||
|
|
||||||
BREAKDOWN OF HDFS-3042 SUBTASKS
|
BREAKDOWN OF HDFS-3042 SUBTASKS
|
||||||
|
|
||||||
HDFS-2185. HDFS portion of ZK-based FailoverController (todd)
|
HDFS-2185. HDFS portion of ZK-based FailoverController (todd)
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
||||||
import org.apache.hadoop.hdfs.server.common.Storage.StorageDirectory;
|
import org.apache.hadoop.hdfs.server.common.Storage.StorageDirectory;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.NNStorage.NameNodeDirType;
|
import org.apache.hadoop.hdfs.server.namenode.NNStorage.NameNodeDirType;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.NNStorage.NameNodeFile;
|
import org.apache.hadoop.hdfs.server.namenode.NNStorage.NameNodeFile;
|
||||||
|
import org.apache.hadoop.io.IOUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inspects a FSImage storage directory in the "old" (pre-HDFS-1073) format.
|
* Inspects a FSImage storage directory in the "old" (pre-HDFS-1073) format.
|
||||||
|
@ -130,8 +131,10 @@ class FSImagePreTransactionalStorageInspector extends FSImageStorageInspector {
|
||||||
DataInputStream in = new DataInputStream(new FileInputStream(timeFile));
|
DataInputStream in = new DataInputStream(new FileInputStream(timeFile));
|
||||||
try {
|
try {
|
||||||
timeStamp = in.readLong();
|
timeStamp = in.readLong();
|
||||||
} finally {
|
|
||||||
in.close();
|
in.close();
|
||||||
|
in = null;
|
||||||
|
} finally {
|
||||||
|
IOUtils.cleanup(LOG, in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return timeStamp;
|
return timeStamp;
|
||||||
|
|
|
@ -186,10 +186,12 @@ public class NNStorage extends Storage implements Closeable {
|
||||||
try {
|
try {
|
||||||
oldFile.seek(0);
|
oldFile.seek(0);
|
||||||
int oldVersion = oldFile.readInt();
|
int oldVersion = oldFile.readInt();
|
||||||
|
oldFile.close();
|
||||||
|
oldFile = null;
|
||||||
if (oldVersion < LAST_PRE_UPGRADE_LAYOUT_VERSION)
|
if (oldVersion < LAST_PRE_UPGRADE_LAYOUT_VERSION)
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
oldFile.close();
|
IOUtils.cleanup(LOG, oldFile);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -428,6 +430,8 @@ public class NNStorage extends Storage implements Closeable {
|
||||||
BufferedReader br = new BufferedReader(new FileReader(txidFile));
|
BufferedReader br = new BufferedReader(new FileReader(txidFile));
|
||||||
try {
|
try {
|
||||||
txid = Long.valueOf(br.readLine());
|
txid = Long.valueOf(br.readLine());
|
||||||
|
br.close();
|
||||||
|
br = null;
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.cleanup(LOG, br);
|
IOUtils.cleanup(LOG, br);
|
||||||
}
|
}
|
||||||
|
@ -449,6 +453,8 @@ public class NNStorage extends Storage implements Closeable {
|
||||||
try {
|
try {
|
||||||
fos.write(String.valueOf(txid).getBytes());
|
fos.write(String.valueOf(txid).getBytes());
|
||||||
fos.write('\n');
|
fos.write('\n');
|
||||||
|
fos.close();
|
||||||
|
fos = null;
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.cleanup(LOG, fos);
|
IOUtils.cleanup(LOG, fos);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue