Skip to content

Commit

Permalink
HBASE-24086 Disable output stream capability enforcement when running…
Browse files Browse the repository at this point in the history
… on LocalFileSystem

Signed-off-by: stack <[email protected]>
Signed-off-by: Bharath Vissapragada <[email protected]>
Signed-off-by: Duo Zhang <[email protected]>
  • Loading branch information
ndimiduk committed Apr 3, 2020
1 parent 2a95fff commit 10cbb3f
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -28,24 +28,22 @@
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.hadoop.HadoopIllegalArgumentException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FSDataOutputStreamBuilder;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.fs.LocatedFileStatus;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;
import org.apache.hadoop.fs.RemoteIterator;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.ipc.RemoteException;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
import org.apache.hbase.thirdparty.com.google.common.collect.Lists;

Expand Down Expand Up @@ -350,11 +348,19 @@ public static void setWALRootDir(final Configuration c, final Path root) {
public static FileSystem getWALFileSystem(final Configuration c) throws IOException {
Path p = getWALRootDir(c);
FileSystem fs = p.getFileSystem(c);
// hadoop-core does fs caching, so need to propogate this if set
// hadoop-core does fs caching, so need to propagate this if set
String enforceStreamCapability = c.get(UNSAFE_STREAM_CAPABILITY_ENFORCE);
if (enforceStreamCapability != null) {
fs.getConf().set(UNSAFE_STREAM_CAPABILITY_ENFORCE, enforceStreamCapability);
}
if (fs instanceof LocalFileSystem) {
// running on LocalFileSystem, which does not support the required capabilities `HSYNC`
// and `HFLUSH`. disable enforcement.
final boolean value = false;
LOG.warn("Cannot enforce durability guarantees while running on {}. Setting {}={} for"
+ " this FileSystem.", fs.getUri(), UNSAFE_STREAM_CAPABILITY_ENFORCE, value);
fs.getConf().setBoolean(UNSAFE_STREAM_CAPABILITY_ENFORCE, value);
}
return fs;
}

Expand Down

0 comments on commit 10cbb3f

Please sign in to comment.