HDFS-15882. Fix incorrectly initializing RandomAccessFile based on configuration options (#2751). Contributed by Xie Lei.
Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
parent
7cf5969f0b
commit
6921ec8b40
@ -84,9 +84,9 @@ public EditLogFileOutputStream(Configuration conf, File name, int size)
|
|||||||
doubleBuf = new EditsDoubleBuffer(size);
|
doubleBuf = new EditsDoubleBuffer(size);
|
||||||
RandomAccessFile rp;
|
RandomAccessFile rp;
|
||||||
if (shouldSyncWritesAndSkipFsync) {
|
if (shouldSyncWritesAndSkipFsync) {
|
||||||
rp = new RandomAccessFile(name, "rws");
|
|
||||||
} else {
|
|
||||||
rp = new RandomAccessFile(name, "rw");
|
rp = new RandomAccessFile(name, "rw");
|
||||||
|
} else {
|
||||||
|
rp = new RandomAccessFile(name, "rws");
|
||||||
}
|
}
|
||||||
fp = new FileOutputStream(rp.getFD()); // open for append
|
fp = new FileOutputStream(rp.getFD()); // open for append
|
||||||
fc = rp.getChannel();
|
fc = rp.getChannel();
|
||||||
|
Loading…
Reference in New Issue
Block a user