HDFS-6954. With crypto, no native lib systems are too verbose. Contributed by Charles Lamb.

This commit is contained in:
Andrew Wang 2014-09-02 14:22:20 -07:00
parent faa4455be5
commit a0ccf83dfd
4 changed files with 25 additions and 15 deletions

View File

@ -24,6 +24,7 @@
import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configurable; import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.PerformanceAdvisory;
import org.apache.hadoop.util.ReflectionUtils; import org.apache.hadoop.util.ReflectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -48,7 +49,7 @@ public abstract class CryptoCodec implements Configurable {
* *
* @param conf * @param conf
* the configuration * the configuration
* @param CipherSuite * @param cipherSuite
* algorithm/mode/padding * algorithm/mode/padding
* @return CryptoCodec the codec object. Null value will be returned if no * @return CryptoCodec the codec object. Null value will be returned if no
* crypto codec classes with cipher suite configured. * crypto codec classes with cipher suite configured.
@ -66,15 +67,18 @@ public static CryptoCodec getInstance(Configuration conf,
CryptoCodec c = ReflectionUtils.newInstance(klass, conf); CryptoCodec c = ReflectionUtils.newInstance(klass, conf);
if (c.getCipherSuite().getName().equals(cipherSuite.getName())) { if (c.getCipherSuite().getName().equals(cipherSuite.getName())) {
if (codec == null) { if (codec == null) {
LOG.debug("Using crypto codec {}.", klass.getName()); PerformanceAdvisory.LOG.debug("Using crypto codec {}.",
klass.getName());
codec = c; codec = c;
} }
} else { } else {
LOG.warn("Crypto codec {} doesn't meet the cipher suite {}.", PerformanceAdvisory.LOG.debug(
"Crypto codec {} doesn't meet the cipher suite {}.",
klass.getName(), cipherSuite.getName()); klass.getName(), cipherSuite.getName());
} }
} catch (Exception e) { } catch (Exception e) {
LOG.warn("Crypto codec {} is not available.", klass.getName()); PerformanceAdvisory.LOG.debug("Crypto codec {} is not available.",
klass.getName());
} }
} }
@ -108,7 +112,8 @@ private static List<Class<? extends CryptoCodec>> getCodecClasses(
cipherSuite.getConfigSuffix(); cipherSuite.getConfigSuffix();
String codecString = conf.get(configName); String codecString = conf.get(configName);
if (codecString == null) { if (codecString == null) {
LOG.warn("No crypto codec classes with cipher suite configured."); PerformanceAdvisory.LOG.debug(
"No crypto codec classes with cipher suite configured.");
return null; return null;
} }
for (String c : Splitter.on(',').trimResults().omitEmptyStrings(). for (String c : Splitter.on(',').trimResults().omitEmptyStrings().
@ -117,9 +122,9 @@ private static List<Class<? extends CryptoCodec>> getCodecClasses(
Class<?> cls = conf.getClassByName(c); Class<?> cls = conf.getClassByName(c);
result.add(cls.asSubclass(CryptoCodec.class)); result.add(cls.asSubclass(CryptoCodec.class));
} catch (ClassCastException e) { } catch (ClassCastException e) {
LOG.warn("Class " + c + " is not a CryptoCodec."); PerformanceAdvisory.LOG.debug("Class {} is not a CryptoCodec.", c);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
LOG.warn("Crypto codec " + c + " not found."); PerformanceAdvisory.LOG.debug("Crypto codec {} not found.", c);
} }
} }

View File

@ -16,9 +16,10 @@
*/ */
package org.apache.hadoop.util; package org.apache.hadoop.util;
import org.apache.commons.logging.Log; import org.slf4j.Logger;
import org.apache.commons.logging.LogFactory; import org.slf4j.LoggerFactory;
public class PerformanceAdvisory { public class PerformanceAdvisory {
public static final Log LOG = LogFactory.getLog(PerformanceAdvisory.class); public static final Logger LOG =
LoggerFactory.getLogger(PerformanceAdvisory.class);
} }

View File

@ -432,6 +432,7 @@ Release 2.6.0 - UNRELEASED
HDFS-6634. inotify in HDFS. (James Thomas via wang) HDFS-6634. inotify in HDFS. (James Thomas via wang)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-6690. Deduplicate xattr names in memory. (wang) HDFS-6690. Deduplicate xattr names in memory. (wang)
@ -672,7 +673,8 @@ Release 2.6.0 - UNRELEASED
HDFS-6817. Fix findbugs and other warnings. (yliu) HDFS-6817. Fix findbugs and other warnings. (yliu)
HDFS-6839. Fix TestCLI to expect new output. (clamb) HDFS-6839. Fix TestCLI to expect new output. (clamb)
--
HDFS-6954. With crypto, no native lib systems are too verbose. (clamb via wang)
Release 2.5.1 - UNRELEASED Release 2.5.1 - UNRELEASED

View File

@ -606,10 +606,12 @@ public DFSClient(URI nameNodeUri, ClientProtocol rpcNamenode,
cipherSuites.add(codec.getCipherSuite()); cipherSuites.add(codec.getCipherSuite());
} }
provider = DFSUtil.createKeyProviderCryptoExtension(conf); provider = DFSUtil.createKeyProviderCryptoExtension(conf);
if (LOG.isDebugEnabled()) {
if (provider == null) { if (provider == null) {
LOG.info("No KeyProvider found."); LOG.debug("No KeyProvider found.");
} else { } else {
LOG.info("Found KeyProvider: " + provider.toString()); LOG.debug("Found KeyProvider: " + provider.toString());
}
} }
int numResponseToDrop = conf.getInt( int numResponseToDrop = conf.getInt(
DFSConfigKeys.DFS_CLIENT_TEST_DROP_NAMENODE_RESPONSE_NUM_KEY, DFSConfigKeys.DFS_CLIENT_TEST_DROP_NAMENODE_RESPONSE_NUM_KEY,