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:
lamberken 2021-03-13 14:22:11 +08:00 committed by GitHub
parent 7cf5969f0b
commit 6921ec8b40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -84,9 +84,9 @@ public class EditLogFileOutputStream extends EditLogOutputStream {
doubleBuf = new EditsDoubleBuffer(size);
RandomAccessFile rp;
if (shouldSyncWritesAndSkipFsync) {
rp = new RandomAccessFile(name, "rws");
} else {
rp = new RandomAccessFile(name, "rw");
} else {
rp = new RandomAccessFile(name, "rws");
}
fp = new FileOutputStream(rp.getFD()); // open for append
fc = rp.getChannel();