HDFS-4402. Some small DomainSocket fixes: avoid findbugs warning, change log level, etc. Contributed by Colin Patrick McCabe.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-347@1433242 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d79868d3e5
commit
2fd41b3b42
|
@ -254,7 +254,7 @@ public class DomainSocket implements Closeable {
|
||||||
private void fdUnref(boolean checkClosed) throws AsynchronousCloseException {
|
private void fdUnref(boolean checkClosed) throws AsynchronousCloseException {
|
||||||
int newCount = status.decrementAndGet();
|
int newCount = status.decrementAndGet();
|
||||||
assert (newCount & ~STATUS_CLOSED_MASK) >= 0;
|
assert (newCount & ~STATUS_CLOSED_MASK) >= 0;
|
||||||
if (checkClosed & ((newCount & STATUS_CLOSED_MASK) != 0)) {
|
if (checkClosed && ((newCount & STATUS_CLOSED_MASK) != 0)) {
|
||||||
throw new AsynchronousCloseException();
|
throw new AsynchronousCloseException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,3 +22,6 @@ HDFS-4400. DFSInputStream#getBlockReader: last retries should ignore the cache
|
||||||
|
|
||||||
HDFS-4401. Fix bug in DomainSocket path validation
|
HDFS-4401. Fix bug in DomainSocket path validation
|
||||||
(Colin Patrick McCabe via todd)
|
(Colin Patrick McCabe via todd)
|
||||||
|
|
||||||
|
HDFS-4402. Some small DomainSocket fixes: avoid findbugs warning, change log level, etc.
|
||||||
|
(Colin Patrick McCabe via todd)
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.hadoop.hdfs;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
@ -118,7 +120,9 @@ class BlockReaderLocal implements BlockReader {
|
||||||
// read and handle the common header here. For now just a version
|
// read and handle the common header here. For now just a version
|
||||||
checksumIn.getChannel().position(0);
|
checksumIn.getChannel().position(0);
|
||||||
BlockMetadataHeader header = BlockMetadataHeader
|
BlockMetadataHeader header = BlockMetadataHeader
|
||||||
.readHeader(new DataInputStream(checksumIn));
|
.readHeader(new DataInputStream(
|
||||||
|
new BufferedInputStream(checksumIn,
|
||||||
|
BlockMetadataHeader.getHeaderSize())));
|
||||||
short version = header.getVersion();
|
short version = header.getVersion();
|
||||||
if (version != BlockMetadataHeader.VERSION) {
|
if (version != BlockMetadataHeader.VERSION) {
|
||||||
throw new IOException("Wrong version (" + version + ") of the " +
|
throw new IOException("Wrong version (" + version + ") of the " +
|
||||||
|
|
|
@ -62,7 +62,7 @@ class DomainSocketFactory {
|
||||||
LOG.warn(feature + " is disabled because you have not set " +
|
LOG.warn(feature + " is disabled because you have not set " +
|
||||||
DFSConfigKeys.DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY);
|
DFSConfigKeys.DFS_DATANODE_DOMAIN_SOCKET_PATH_KEY);
|
||||||
} else if (DomainSocket.getLoadingFailureReason() != null) {
|
} else if (DomainSocket.getLoadingFailureReason() != null) {
|
||||||
LOG.error(feature + " is disabled because " +
|
LOG.warn(feature + " is disabled because " +
|
||||||
DomainSocket.getLoadingFailureReason());
|
DomainSocket.getLoadingFailureReason());
|
||||||
} else {
|
} else {
|
||||||
LOG.debug(feature + "is enabled.");
|
LOG.debug(feature + "is enabled.");
|
||||||
|
@ -113,7 +113,7 @@ class DomainSocketFactory {
|
||||||
sock.setAttribute(DomainSocket.RCV_TIMEO, conf.socketTimeout);
|
sock.setAttribute(DomainSocket.RCV_TIMEO, conf.socketTimeout);
|
||||||
success = true;
|
success = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.error("error creating DomainSocket", e);
|
LOG.warn("error creating DomainSocket", e);
|
||||||
// fall through
|
// fall through
|
||||||
} finally {
|
} finally {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import java.util.concurrent.ThreadFactory;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
Loading…
Reference in New Issue