HADOOP-10571. Use Log.*(Object, Throwable) overload to log exceptions.
Contributed by Andras Bokor.
This commit is contained in:
parent
042ef2fa7b
commit
f20dc0d577
|
@ -139,7 +139,7 @@ public class LocalFileSystem extends ChecksumFileSystem {
|
|||
LOG.warn("Ignoring failure of renameTo");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Error moving bad file " + p + ": " + e);
|
||||
LOG.warn("Error moving bad file " + p, e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -888,9 +888,8 @@ public class ActiveStandbyElector implements StatCallback, StringCallback {
|
|||
Stat oldBreadcrumbStat = fenceOldActive();
|
||||
writeBreadCrumbNode(oldBreadcrumbStat);
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Becoming active for " + this);
|
||||
}
|
||||
LOG.debug("Becoming active for {}", this);
|
||||
|
||||
appClient.becomeActive();
|
||||
state = State.ACTIVE;
|
||||
return true;
|
||||
|
@ -910,8 +909,8 @@ public class ActiveStandbyElector implements StatCallback, StringCallback {
|
|||
throws KeeperException, InterruptedException {
|
||||
Preconditions.checkState(appData != null, "no appdata");
|
||||
|
||||
LOG.info("Writing znode " + zkBreadCrumbPath +
|
||||
" to indicate that the local node is the most recent active...");
|
||||
LOG.info("Writing znode {} to indicate that the local " +
|
||||
"node is the most recent active...", zkBreadCrumbPath);
|
||||
if (oldBreadcrumbStat == null) {
|
||||
// No previous active, just create the node
|
||||
createWithRetries(zkBreadCrumbPath, appData, zkAcl,
|
||||
|
@ -948,9 +947,8 @@ public class ActiveStandbyElector implements StatCallback, StringCallback {
|
|||
|
||||
deleteWithRetries(zkBreadCrumbPath, stat.getVersion());
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Unable to delete our own bread-crumb of being active at " +
|
||||
zkBreadCrumbPath + ": " + e.getLocalizedMessage() + ". " +
|
||||
"Expecting to be fenced by the next active.");
|
||||
LOG.warn("Unable to delete our own bread-crumb of being active at {}." +
|
||||
". Expecting to be fenced by the next active.", zkBreadCrumbPath, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -984,7 +982,7 @@ public class ActiveStandbyElector implements StatCallback, StringCallback {
|
|||
throw ke;
|
||||
}
|
||||
|
||||
LOG.info("Old node exists: " + StringUtils.byteToHexString(data));
|
||||
LOG.info("Old node exists: {}", StringUtils.byteToHexString(data));
|
||||
if (Arrays.equals(data, appData)) {
|
||||
LOG.info("But old node has our own data, so don't need to fence it.");
|
||||
} else {
|
||||
|
@ -995,9 +993,7 @@ public class ActiveStandbyElector implements StatCallback, StringCallback {
|
|||
|
||||
private void becomeStandby() {
|
||||
if (state != State.STANDBY) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Becoming standby for " + this);
|
||||
}
|
||||
LOG.debug("Becoming standby for {}", this);
|
||||
state = State.STANDBY;
|
||||
appClient.becomeStandby();
|
||||
}
|
||||
|
@ -1005,9 +1001,7 @@ public class ActiveStandbyElector implements StatCallback, StringCallback {
|
|||
|
||||
private void enterNeutralMode() {
|
||||
if (state != State.NEUTRAL) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Entering neutral mode for " + this);
|
||||
}
|
||||
LOG.debug("Entering neutral mode for {}", this);
|
||||
state = State.NEUTRAL;
|
||||
appClient.enterNeutralMode();
|
||||
}
|
||||
|
@ -1124,7 +1118,7 @@ public class ActiveStandbyElector implements StatCallback, StringCallback {
|
|||
private synchronized boolean isStaleClient(Object ctx) {
|
||||
Preconditions.checkNotNull(ctx);
|
||||
if (zkClient != (ZooKeeper)ctx) {
|
||||
LOG.warn("Ignoring stale result from old client with sessionId " +
|
||||
LOG.warn("Ignoring stale result from old client with sessionId {}",
|
||||
String.format("0x%08x", ((ZooKeeper)ctx).getSessionId()));
|
||||
return true;
|
||||
}
|
||||
|
@ -1162,8 +1156,8 @@ public class ActiveStandbyElector implements StatCallback, StringCallback {
|
|||
throws KeeperException, IOException {
|
||||
try {
|
||||
if (!hasReceivedEvent.await(connectionTimeoutMs, TimeUnit.MILLISECONDS)) {
|
||||
LOG.error("Connection timed out: couldn't connect to ZooKeeper in "
|
||||
+ connectionTimeoutMs + " milliseconds");
|
||||
LOG.error("Connection timed out: couldn't connect to ZooKeeper in " +
|
||||
"{} milliseconds", connectionTimeoutMs);
|
||||
zk.close();
|
||||
throw KeeperException.create(Code.CONNECTIONLOSS);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ public class FailoverController {
|
|||
toSvcStatus = toSvc.getServiceStatus();
|
||||
} catch (IOException e) {
|
||||
String msg = "Unable to get service state for " + target;
|
||||
LOG.error(msg + ": " + e.getLocalizedMessage());
|
||||
LOG.error(msg, e);
|
||||
throw new FailoverFailedException(msg, e);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class FailoverController {
|
|||
target + " is not ready to become active: " +
|
||||
notReadyReason);
|
||||
} else {
|
||||
LOG.warn("Service is not ready to become active, but forcing: " +
|
||||
LOG.warn("Service is not ready to become active, but forcing: {}",
|
||||
notReadyReason);
|
||||
}
|
||||
}
|
||||
|
@ -172,11 +172,11 @@ public class FailoverController {
|
|||
proxy.transitionToStandby(createReqInfo());
|
||||
return true;
|
||||
} catch (ServiceFailedException sfe) {
|
||||
LOG.warn("Unable to gracefully make " + svc + " standby (" +
|
||||
sfe.getMessage() + ")");
|
||||
LOG.warn("Unable to gracefully make {} standby ({})",
|
||||
svc, sfe.getMessage());
|
||||
} catch (IOException ioe) {
|
||||
LOG.warn("Unable to gracefully make " + svc +
|
||||
" standby (unable to connect)", ioe);
|
||||
LOG.warn("Unable to gracefully make {} standby (unable to connect)",
|
||||
svc, ioe);
|
||||
} finally {
|
||||
if (proxy != null) {
|
||||
RPC.stopProxy(proxy);
|
||||
|
@ -227,13 +227,13 @@ public class FailoverController {
|
|||
toSvc.getProxy(conf, rpcTimeoutToNewActive),
|
||||
createReqInfo());
|
||||
} catch (ServiceFailedException sfe) {
|
||||
LOG.error("Unable to make " + toSvc + " active (" +
|
||||
sfe.getMessage() + "). Failing back.");
|
||||
LOG.error("Unable to make {} active ({}). Failing back.",
|
||||
toSvc, sfe.getMessage());
|
||||
failed = true;
|
||||
cause = sfe;
|
||||
} catch (IOException ioe) {
|
||||
LOG.error("Unable to make " + toSvc +
|
||||
" active (unable to connect). Failing back.", ioe);
|
||||
LOG.error("Unable to make {} active (unable to connect). Failing back.",
|
||||
toSvc, ioe);
|
||||
failed = true;
|
||||
cause = ioe;
|
||||
}
|
||||
|
|
|
@ -204,12 +204,11 @@ public class HealthMonitor {
|
|||
healthy = true;
|
||||
} catch (Throwable t) {
|
||||
if (isHealthCheckFailedException(t)) {
|
||||
LOG.warn("Service health check failed for " + targetToMonitor
|
||||
+ ": " + t.getMessage());
|
||||
LOG.warn("Service health check failed for {}", targetToMonitor, t);
|
||||
enterState(State.SERVICE_UNHEALTHY);
|
||||
} else {
|
||||
LOG.warn("Transport-level exception trying to monitor health of " +
|
||||
targetToMonitor + ": " + t.getCause() + " " + t.getLocalizedMessage());
|
||||
LOG.warn("Transport-level exception trying to monitor health of {}",
|
||||
targetToMonitor, t);
|
||||
RPC.stopProxy(proxy);
|
||||
proxy = null;
|
||||
enterState(State.SERVICE_NOT_RESPONDING);
|
||||
|
@ -246,7 +245,7 @@ public class HealthMonitor {
|
|||
|
||||
private synchronized void enterState(State newState) {
|
||||
if (newState != state) {
|
||||
LOG.info("Entering state " + newState);
|
||||
LOG.info("Entering state {}", newState);
|
||||
state = newState;
|
||||
synchronized (callbacks) {
|
||||
for (Callback cb : callbacks) {
|
||||
|
|
|
@ -72,9 +72,7 @@ public class RetryUtils {
|
|||
retryPolicySpecKey, defaultRetryPolicySpec
|
||||
);
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("multipleLinearRandomRetry = " + multipleLinearRandomRetry);
|
||||
}
|
||||
LOG.debug("multipleLinearRandomRetry = {}", multipleLinearRandomRetry);
|
||||
|
||||
if (multipleLinearRandomRetry == null) {
|
||||
//no retry
|
||||
|
@ -124,10 +122,9 @@ public class RetryUtils {
|
|||
p = RetryPolicies.TRY_ONCE_THEN_FAIL;
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("RETRY " + retries + ") policy="
|
||||
+ p.getClass().getSimpleName() + ", exception=" + e);
|
||||
}
|
||||
LOG.debug("RETRY {}) policy={}", retries,
|
||||
p.getClass().getSimpleName(), e);
|
||||
|
||||
return p.shouldRetry(e, retries, failovers, isMethodIdempotent);
|
||||
}
|
||||
|
||||
|
|
|
@ -179,8 +179,7 @@ public class DNS {
|
|||
netIf = getSubinterface(strInterface);
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
LOG.warn("I/O error finding interface " + strInterface +
|
||||
": " + e.getMessage());
|
||||
LOG.warn("I/O error finding interface {}", strInterface, e);
|
||||
return new String[] { cachedHostAddress };
|
||||
}
|
||||
if (netIf == null) {
|
||||
|
@ -265,7 +264,7 @@ public class DNS {
|
|||
}
|
||||
|
||||
if (hosts.isEmpty()) {
|
||||
LOG.warn("Unable to determine hostname for interface " +
|
||||
LOG.warn("Unable to determine hostname for interface {}",
|
||||
strInterface);
|
||||
hosts.add(cachedHostname);
|
||||
}
|
||||
|
@ -283,8 +282,8 @@ public class DNS {
|
|||
try {
|
||||
localhost = InetAddress.getLocalHost().getCanonicalHostName();
|
||||
} catch (UnknownHostException e) {
|
||||
LOG.warn("Unable to determine local hostname "
|
||||
+ "-falling back to \"" + LOCALHOST + "\"", e);
|
||||
LOG.warn("Unable to determine local hostname -falling back to '{}'",
|
||||
LOCALHOST, e);
|
||||
localhost = LOCALHOST;
|
||||
}
|
||||
return localhost;
|
||||
|
@ -306,15 +305,15 @@ public class DNS {
|
|||
try {
|
||||
address = InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
LOG.warn("Unable to determine address of the host"
|
||||
+ "-falling back to \"" + LOCALHOST + "\" address", e);
|
||||
LOG.warn("Unable to determine address of the host " +
|
||||
"-falling back to '{}' address", LOCALHOST, e);
|
||||
try {
|
||||
address = InetAddress.getByName(LOCALHOST).getHostAddress();
|
||||
} catch (UnknownHostException noLocalHostAddressException) {
|
||||
//at this point, deep trouble
|
||||
LOG.error("Unable to determine local loopback address "
|
||||
+ "of \"" + LOCALHOST + "\" " +
|
||||
"-this system's network configuration is unsupported", e);
|
||||
LOG.error("Unable to determine local loopback address of '{}' " +
|
||||
"-this system's network configuration is unsupported",
|
||||
LOCALHOST, e);
|
||||
address = null;
|
||||
}
|
||||
}
|
||||
|
@ -431,8 +430,8 @@ public class DNS {
|
|||
netIf = getSubinterface(strInterface);
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
LOG.warn("I/O error finding interface " + strInterface +
|
||||
": " + e.getMessage());
|
||||
LOG.warn("I/O error finding interface {}: {}",
|
||||
strInterface, e.getMessage());
|
||||
return Arrays.asList(InetAddress.getByName(cachedHostAddress));
|
||||
}
|
||||
if (netIf == null) {
|
||||
|
|
|
@ -194,9 +194,7 @@ public abstract class AbstractService implements Service {
|
|||
serviceStart();
|
||||
if (isInState(STATE.STARTED)) {
|
||||
//if the service started (and isn't now in a later state), notify
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Service " + getName() + " is started");
|
||||
}
|
||||
LOG.debug("Service {} is started", getName());
|
||||
notifyListeners();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -235,12 +233,10 @@ public abstract class AbstractService implements Service {
|
|||
}
|
||||
} else {
|
||||
//already stopped: note it
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Ignoring re-entrant call to stop()");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Relay to {@link #stop()}
|
||||
|
@ -258,9 +254,7 @@ public abstract class AbstractService implements Service {
|
|||
* @param exception the exception
|
||||
*/
|
||||
protected final void noteFailure(Exception exception) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("noteFailure " + exception, (Throwable) null);
|
||||
}
|
||||
LOG.debug("noteFailure {}" + exception);
|
||||
if (exception == null) {
|
||||
//make sure failure logic doesn't itself cause problems
|
||||
return;
|
||||
|
@ -270,10 +264,8 @@ public abstract class AbstractService implements Service {
|
|||
if (failureCause == null) {
|
||||
failureCause = exception;
|
||||
failureState = getServiceState();
|
||||
LOG.info("Service " + getName()
|
||||
+ " failed in state " + failureState
|
||||
+ "; cause: " + exception,
|
||||
exception);
|
||||
LOG.info("Service {} failed in state {}",
|
||||
getName(), failureState, exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -418,8 +410,7 @@ public abstract class AbstractService implements Service {
|
|||
listeners.notifyListeners(this);
|
||||
globalListeners.notifyListeners(this);
|
||||
} catch (Throwable e) {
|
||||
LOG.warn("Exception while notifying listeners of " + this + ": " + e,
|
||||
e);
|
||||
LOG.warn("Exception while notifying listeners of {}", this, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -449,10 +440,8 @@ public abstract class AbstractService implements Service {
|
|||
assert stateModel != null : "null state in " + name + " " + this.getClass();
|
||||
STATE oldState = stateModel.enterState(newState);
|
||||
if (oldState != newState) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(
|
||||
"Service: " + getName() + " entered state " + getServiceState());
|
||||
}
|
||||
LOG.debug("Service: {} entered state {}", getName(), getServiceState());
|
||||
|
||||
recordLifecycleEvent();
|
||||
}
|
||||
return oldState;
|
||||
|
|
|
@ -81,9 +81,7 @@ public final class ServiceOperations {
|
|||
try {
|
||||
stop(service);
|
||||
} catch (Exception e) {
|
||||
log.warn("When stopping the service " + service.getName()
|
||||
+ " : " + e,
|
||||
e);
|
||||
log.warn("When stopping the service " + service.getName(), e);
|
||||
return e;
|
||||
}
|
||||
return null;
|
||||
|
@ -103,7 +101,7 @@ public final class ServiceOperations {
|
|||
try {
|
||||
stop(service);
|
||||
} catch (Exception e) {
|
||||
log.warn("When stopping the service {} : {}", service.getName(), e, e);
|
||||
log.warn("When stopping the service {}", service.getName(), e);
|
||||
return e;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -57,8 +57,7 @@ public class TestServiceOperations {
|
|||
ServiceOperations.stopQuietly(logger, service);
|
||||
|
||||
assertThat(logCapturer.getOutput(),
|
||||
containsString("When stopping the service " + service.getName()
|
||||
+ " : " + e));
|
||||
containsString("When stopping the service " + service.getName()));
|
||||
verify(e, times(1)).printStackTrace(Mockito.any(PrintWriter.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
*/
|
||||
package org.apache.hadoop.hdfs.nfs.nfs3;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.file.FileSystemException;
|
||||
|
@ -32,7 +30,6 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.hadoop.fs.FSDataInputStream;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.hdfs.DFSClient;
|
||||
|
@ -50,12 +47,15 @@ import com.google.common.cache.CacheLoader;
|
|||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.cache.RemovalListener;
|
||||
import com.google.common.cache.RemovalNotification;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* A cache saves DFSClient objects for different users.
|
||||
*/
|
||||
class DFSClientCache {
|
||||
private static final Log LOG = LogFactory.getLog(DFSClientCache.class);
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(DFSClientCache.class);
|
||||
/**
|
||||
* Cache that maps User id to the corresponding DFSClient.
|
||||
*/
|
||||
|
@ -169,8 +169,8 @@ class DFSClientCache {
|
|||
URI value = namenodeUriMap.get(namenodeId);
|
||||
// if a unique nnid, add it to the map
|
||||
if (value == null) {
|
||||
LOG.info("Added export:" + exportPath + " FileSystem URI:" + exportURI
|
||||
+ " with namenodeId:" + namenodeId);
|
||||
LOG.info("Added export: {} FileSystem URI: {} with namenodeId: {}",
|
||||
exportPath, exportPath, namenodeId);
|
||||
namenodeUriMap.put(namenodeId, exportURI);
|
||||
} else {
|
||||
// if the nnid already exists, it better be the for the same namenode
|
||||
|
@ -194,7 +194,7 @@ class DFSClientCache {
|
|||
try {
|
||||
closeAll(true);
|
||||
} catch (IOException e) {
|
||||
LOG.info("DFSClientCache.closeAll() threw an exception:\n", e);
|
||||
LOG.info("DFSClientCache.closeAll() threw an exception", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -269,10 +269,7 @@ class DFSClientCache {
|
|||
|
||||
UserGroupInformation ugi =
|
||||
UserGroupInformation.createProxyUser(effectiveUser, realUser);
|
||||
if (LOG.isDebugEnabled()){
|
||||
LOG.debug(String.format("Created ugi:" +
|
||||
" %s for username: %s", ugi, effectiveUser));
|
||||
}
|
||||
LOG.debug("Created ugi: {} for username: {}", ugi, effectiveUser);
|
||||
return ugi;
|
||||
}
|
||||
|
||||
|
@ -329,8 +326,7 @@ class DFSClientCache {
|
|||
try {
|
||||
client = clientCache.get(new DfsClientKey(userName, namenodeId));
|
||||
} catch (ExecutionException e) {
|
||||
LOG.error("Failed to create DFSClient for user:" + userName + " Cause:"
|
||||
+ e);
|
||||
LOG.error("Failed to create DFSClient for user: {}", userName, e);
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
@ -343,8 +339,7 @@ class DFSClientCache {
|
|||
try {
|
||||
s = inputstreamCache.get(k);
|
||||
} catch (ExecutionException e) {
|
||||
LOG.warn("Failed to create DFSInputStream for user:" + userName
|
||||
+ " Cause:" + e);
|
||||
LOG.warn("Failed to create DFSInputStream for user: {}", userName, e);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@ import java.util.concurrent.ConcurrentNavigableMap;
|
|||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.fs.FSDataInputStream;
|
||||
import org.apache.hadoop.hdfs.DFSClient;
|
||||
import org.apache.hadoop.hdfs.client.HdfsDataOutputStream;
|
||||
|
@ -61,13 +59,15 @@ import org.jboss.netty.channel.Channel;
|
|||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* OpenFileCtx saves the context of one HDFS file output stream. Access to it is
|
||||
* synchronized by its member lock.
|
||||
*/
|
||||
class OpenFileCtx {
|
||||
public static final Log LOG = LogFactory.getLog(OpenFileCtx.class);
|
||||
public static final Logger LOG = LoggerFactory.getLogger(OpenFileCtx.class);
|
||||
|
||||
// Pending writes water mark for dump, 1MB
|
||||
private static long DUMP_WRITE_WATER_MARK = 1024 * 1024;
|
||||
|
@ -210,10 +210,8 @@ class OpenFileCtx {
|
|||
/** Increase or decrease the memory occupation of non-sequential writes */
|
||||
private long updateNonSequentialWriteInMemory(long count) {
|
||||
long newValue = nonSequentialWriteInMemory.addAndGet(count);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Update nonSequentialWriteInMemory by " + count + " new value: "
|
||||
+ newValue);
|
||||
}
|
||||
LOG.debug("Update nonSequentialWriteInMemory by {} new value: {}",
|
||||
count, newValue);
|
||||
|
||||
Preconditions.checkState(newValue >= 0,
|
||||
"nonSequentialWriteInMemory is negative " + newValue
|
||||
|
@ -273,9 +271,7 @@ class OpenFileCtx {
|
|||
// Check if need to dump the new writes
|
||||
private void waitForDump() {
|
||||
if (!enabledDump) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Do nothing, dump is disabled.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -286,9 +282,7 @@ class OpenFileCtx {
|
|||
// wake up the dumper thread to dump the data
|
||||
synchronized (this) {
|
||||
if (nonSequentialWriteInMemory.get() >= DUMP_WRITE_WATER_MARK) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Asking dumper to dump...");
|
||||
}
|
||||
if (dumpThread == null) {
|
||||
dumpThread = new Daemon(new Dumper());
|
||||
dumpThread.start();
|
||||
|
@ -312,7 +306,7 @@ class OpenFileCtx {
|
|||
private void dump() {
|
||||
// Create dump outputstream for the first time
|
||||
if (dumpOut == null) {
|
||||
LOG.info("Create dump file: " + dumpFilePath);
|
||||
LOG.info("Create dump file: {}", dumpFilePath);
|
||||
File dumpFile = new File(dumpFilePath);
|
||||
try {
|
||||
synchronized (this) {
|
||||
|
@ -322,13 +316,14 @@ class OpenFileCtx {
|
|||
dumpOut = new FileOutputStream(dumpFile);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("Got failure when creating dump stream " + dumpFilePath, e);
|
||||
LOG.error("Got failure when creating dump stream {}",
|
||||
dumpFilePath, e);
|
||||
enabledDump = false;
|
||||
if (dumpOut != null) {
|
||||
try {
|
||||
dumpOut.close();
|
||||
} catch (IOException e1) {
|
||||
LOG.error("Can't close dump stream " + dumpFilePath, e);
|
||||
LOG.error("Can't close dump stream {}", dumpFilePath, e);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -340,17 +335,15 @@ class OpenFileCtx {
|
|||
try {
|
||||
raf = new RandomAccessFile(dumpFilePath, "r");
|
||||
} catch (FileNotFoundException e) {
|
||||
LOG.error("Can't get random access to file " + dumpFilePath);
|
||||
LOG.error("Can't get random access to file {}", dumpFilePath);
|
||||
// Disable dump
|
||||
enabledDump = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Start dump. Before dump, nonSequentialWriteInMemory == "
|
||||
+ nonSequentialWriteInMemory.get());
|
||||
}
|
||||
LOG.debug("Start dump. Before dump, nonSequentialWriteInMemory == {}",
|
||||
nonSequentialWriteInMemory.get());
|
||||
|
||||
Iterator<OffsetRange> it = pendingWrites.keySet().iterator();
|
||||
while (activeState && it.hasNext()
|
||||
|
@ -367,18 +360,16 @@ class OpenFileCtx {
|
|||
updateNonSequentialWriteInMemory(-dumpedDataSize);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("Dump data failed: " + writeCtx + " with error: " + e
|
||||
+ " OpenFileCtx state: " + activeState);
|
||||
LOG.error("Dump data failed: {} OpenFileCtx state: {}",
|
||||
writeCtx, activeState, e);
|
||||
// Disable dump
|
||||
enabledDump = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("After dump, nonSequentialWriteInMemory == "
|
||||
+ nonSequentialWriteInMemory.get());
|
||||
}
|
||||
LOG.debug("After dump, nonSequentialWriteInMemory == {}",
|
||||
nonSequentialWriteInMemory.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -393,26 +384,22 @@ class OpenFileCtx {
|
|||
OpenFileCtx.this.notifyAll();
|
||||
try {
|
||||
OpenFileCtx.this.wait();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Dumper woke up");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
LOG.info("Dumper is interrupted, dumpFilePath= "
|
||||
+ OpenFileCtx.this.dumpFilePath);
|
||||
LOG.info("Dumper is interrupted, dumpFilePath = {}",
|
||||
OpenFileCtx.this.dumpFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Dumper checking OpenFileCtx activeState: " + activeState
|
||||
+ " enabledDump: " + enabledDump);
|
||||
}
|
||||
LOG.debug("Dumper checking OpenFileCtx activeState: {} " +
|
||||
"enabledDump: {}", activeState, enabledDump);
|
||||
} catch (Throwable t) {
|
||||
// unblock threads with new request
|
||||
synchronized (OpenFileCtx.this) {
|
||||
OpenFileCtx.this.notifyAll();
|
||||
}
|
||||
LOG.info("Dumper get Throwable: " + t + ". dumpFilePath: "
|
||||
+ OpenFileCtx.this.dumpFilePath, t);
|
||||
LOG.info("Dumper got Throwable. dumpFilePath: {}",
|
||||
OpenFileCtx.this.dumpFilePath, t);
|
||||
activeState = false;
|
||||
}
|
||||
}
|
||||
|
@ -428,8 +415,8 @@ class OpenFileCtx {
|
|||
return null;
|
||||
} else {
|
||||
if (xid != writeCtx.getXid()) {
|
||||
LOG.warn("Got a repeated request, same range, with a different xid: "
|
||||
+ xid + " xid in old request: " + writeCtx.getXid());
|
||||
LOG.warn("Got a repeated request, same range, with a different xid: " +
|
||||
"{} xid in old request: {}", xid, writeCtx.getXid());
|
||||
//TODO: better handling.
|
||||
}
|
||||
return writeCtx;
|
||||
|
@ -441,8 +428,8 @@ class OpenFileCtx {
|
|||
IdMappingServiceProvider iug) {
|
||||
|
||||
if (!activeState) {
|
||||
LOG.info("OpenFileCtx is inactive, fileId: "
|
||||
+ request.getHandle().dumpFileHandle());
|
||||
LOG.info("OpenFileCtx is inactive, fileId: {}",
|
||||
request.getHandle().dumpFileHandle());
|
||||
WccData fileWcc = new WccData(latestAttr.getWccAttr(), latestAttr);
|
||||
WRITE3Response response = new WRITE3Response(Nfs3Status.NFS3ERR_IO,
|
||||
fileWcc, 0, request.getStableHow(), Nfs3Constant.WRITE_COMMIT_VERF);
|
||||
|
@ -460,15 +447,11 @@ class OpenFileCtx {
|
|||
xid);
|
||||
if (existantWriteCtx != null) {
|
||||
if (!existantWriteCtx.getReplied()) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Repeated write request which hasn't been served: xid="
|
||||
+ xid + ", drop it.");
|
||||
}
|
||||
LOG.debug("Repeated write request which hasn't been served: " +
|
||||
"xid={}, drop it.", xid);
|
||||
} else {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Repeated write request which is already served: xid="
|
||||
+ xid + ", resend response.");
|
||||
}
|
||||
LOG.debug("Repeated write request which is already served: xid={}" +
|
||||
", resend response.", xid);
|
||||
WccData fileWcc = new WccData(latestAttr.getWccAttr(), latestAttr);
|
||||
WRITE3Response response = new WRITE3Response(Nfs3Status.NFS3_OK,
|
||||
fileWcc, request.getCount(), request.getStableHow(),
|
||||
|
@ -489,13 +472,11 @@ class OpenFileCtx {
|
|||
long offset = request.getOffset();
|
||||
int count = request.getCount();
|
||||
long smallerCount = offset + count - cachedOffset;
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(String.format("Got overwrite with appended data [%d-%d),"
|
||||
+ " current offset %d," + " drop the overlapped section [%d-%d)"
|
||||
+ " and append new data [%d-%d).", offset, (offset + count),
|
||||
cachedOffset, offset, cachedOffset, cachedOffset, (offset
|
||||
+ count)));
|
||||
}
|
||||
LOG.debug("Got overwrite with appended data [{}-{}),"
|
||||
+ " current offset {}," + " drop the overlapped section [{}-{})"
|
||||
+ " and append new data [{}-{}).", offset, (offset + count),
|
||||
cachedOffset, offset, cachedOffset, cachedOffset,
|
||||
(offset + count));
|
||||
|
||||
ByteBuffer data = request.getData();
|
||||
Preconditions.checkState(data.position() == 0,
|
||||
|
@ -538,10 +519,8 @@ class OpenFileCtx {
|
|||
long cachedOffset = nextOffset.get();
|
||||
int originalCount = WriteCtx.INVALID_ORIGINAL_COUNT;
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("requested offset=" + offset + " and current offset="
|
||||
+ cachedOffset);
|
||||
}
|
||||
LOG.debug("requested offset={} and current offset={}",
|
||||
offset, cachedOffset);
|
||||
|
||||
// Ignore write request with range below the current offset
|
||||
if (offset + count <= cachedOffset) {
|
||||
|
@ -576,8 +555,8 @@ class OpenFileCtx {
|
|||
|
||||
// Fail non-append call
|
||||
if (offset < cachedOffset) {
|
||||
LOG.warn("(offset,count,nextOffset): " + "(" + offset + "," + count + ","
|
||||
+ nextOffset + ")");
|
||||
LOG.warn("(offset,count,nextOffset): ({},{},{})",
|
||||
offset, count, nextOffset);
|
||||
return null;
|
||||
} else {
|
||||
DataState dataState = offset == cachedOffset ? WriteCtx.DataState.NO_DUMP
|
||||
|
@ -586,10 +565,8 @@ class OpenFileCtx {
|
|||
request.getOffset(), request.getCount(), originalCount,
|
||||
request.getStableHow(), request.getData(), channel, xid, false,
|
||||
dataState);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Add new write to the list with nextOffset " + cachedOffset
|
||||
+ " and requested offset=" + offset);
|
||||
}
|
||||
LOG.debug("Add new write to the list with nextOffset {}" +
|
||||
" and requested offset={}", cachedOffset, offset);
|
||||
if (writeCtx.getDataState() == WriteCtx.DataState.ALLOW_DUMP) {
|
||||
// update the memory size
|
||||
updateNonSequentialWriteInMemory(count);
|
||||
|
@ -598,14 +575,12 @@ class OpenFileCtx {
|
|||
WriteCtx oldWriteCtx = checkRepeatedWriteRequest(request, channel, xid);
|
||||
if (oldWriteCtx == null) {
|
||||
pendingWrites.put(new OffsetRange(offset, offset + count), writeCtx);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("New write buffered with xid " + xid + " nextOffset "
|
||||
+ cachedOffset + " req offset=" + offset + " mapsize="
|
||||
+ pendingWrites.size());
|
||||
}
|
||||
LOG.debug("New write buffered with xid {} nextOffset {}" +
|
||||
"req offset={} mapsize={}",
|
||||
xid, cachedOffset, offset, pendingWrites.size());
|
||||
} else {
|
||||
LOG.warn("Got a repeated request, same range, with xid: " + xid
|
||||
+ " nextOffset " + +cachedOffset + " req offset=" + offset);
|
||||
LOG.warn("Got a repeated request, same range, with xid: " +
|
||||
"{} nextOffset {} req offset={}", xid, cachedOffset, offset);
|
||||
}
|
||||
return writeCtx;
|
||||
}
|
||||
|
@ -625,9 +600,7 @@ class OpenFileCtx {
|
|||
response = new WRITE3Response(Nfs3Status.NFS3ERR_INVAL, wccData, 0,
|
||||
WriteStableHow.UNSTABLE, Nfs3Constant.WRITE_COMMIT_VERF);
|
||||
} else {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Process perfectOverWrite");
|
||||
}
|
||||
// TODO: let executor handle perfect overwrite
|
||||
response = processPerfectOverWrite(dfsClient, offset, count, stableHow,
|
||||
request.getData().array(),
|
||||
|
@ -652,18 +625,14 @@ class OpenFileCtx {
|
|||
|
||||
if (writeCtx.getOffset() == nextOffset.get()) {
|
||||
if (!asyncStatus) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Trigger the write back task. Current nextOffset: "
|
||||
+ nextOffset.get());
|
||||
}
|
||||
LOG.debug("Trigger the write back task. Current nextOffset: {}",
|
||||
nextOffset.get());
|
||||
asyncStatus = true;
|
||||
asyncWriteBackStartOffset = writeCtx.getOffset();
|
||||
asyncDataService.execute(new AsyncDataService.WriteBackTask(this));
|
||||
} else {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("The write back thread is working.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -694,15 +663,13 @@ class OpenFileCtx {
|
|||
// responses of the previous batch. So here send response immediately
|
||||
// for unstable non-sequential write
|
||||
if (stableHow != WriteStableHow.UNSTABLE) {
|
||||
LOG.info("Have to change stable write to unstable write: "
|
||||
+ request.getStableHow());
|
||||
LOG.info("Have to change stable write to unstable write: {}",
|
||||
request.getStableHow());
|
||||
stableHow = WriteStableHow.UNSTABLE;
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("UNSTABLE write request, send response for offset: "
|
||||
+ writeCtx.getOffset());
|
||||
}
|
||||
LOG.debug("UNSTABLE write request, send response for offset: {}",
|
||||
writeCtx.getOffset());
|
||||
WccData fileWcc = new WccData(preOpAttr, latestAttr);
|
||||
WRITE3Response response = new WRITE3Response(Nfs3Status.NFS3_OK,
|
||||
fileWcc, count, stableHow, Nfs3Constant.WRITE_COMMIT_VERF);
|
||||
|
@ -738,8 +705,8 @@ class OpenFileCtx {
|
|||
LOG.info("The FSDataOutputStream has been closed. "
|
||||
+ "Continue processing the perfect overwrite.");
|
||||
} catch (IOException e) {
|
||||
LOG.info("hsync failed when processing possible perfect overwrite, path="
|
||||
+ path + " error: " + e);
|
||||
LOG.info("hsync failed when processing possible perfect overwrite, " +
|
||||
"path={} error: {}", path, e.toString());
|
||||
return new WRITE3Response(Nfs3Status.NFS3ERR_IO, wccData, 0, stableHow,
|
||||
Nfs3Constant.WRITE_COMMIT_VERF);
|
||||
}
|
||||
|
@ -748,18 +715,18 @@ class OpenFileCtx {
|
|||
fis = dfsClient.createWrappedInputStream(dfsClient.open(path));
|
||||
readCount = fis.read(offset, readbuffer, 0, count);
|
||||
if (readCount < count) {
|
||||
LOG.error("Can't read back " + count + " bytes, partial read size: "
|
||||
+ readCount);
|
||||
LOG.error("Can't read back {} bytes, partial read size: {}",
|
||||
count, readCount);
|
||||
return new WRITE3Response(Nfs3Status.NFS3ERR_IO, wccData, 0, stableHow,
|
||||
Nfs3Constant.WRITE_COMMIT_VERF);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.info("Read failed when processing possible perfect overwrite, path="
|
||||
+ path, e);
|
||||
LOG.info("Read failed when processing possible perfect overwrite, " +
|
||||
"path={}", path, e);
|
||||
return new WRITE3Response(Nfs3Status.NFS3ERR_IO, wccData, 0, stableHow,
|
||||
Nfs3Constant.WRITE_COMMIT_VERF);
|
||||
} finally {
|
||||
IOUtils.cleanup(LOG, fis);
|
||||
IOUtils.cleanupWithLogger(LOG, fis);
|
||||
}
|
||||
|
||||
// Compare with the request
|
||||
|
@ -776,8 +743,8 @@ class OpenFileCtx {
|
|||
dfsClient.setTimes(path, Time.monotonicNow(), -1);
|
||||
postOpAttr = Nfs3Utils.getFileAttr(dfsClient, path, iug);
|
||||
} catch (IOException e) {
|
||||
LOG.info("Got error when processing perfect overwrite, path=" + path
|
||||
+ " error: " + e);
|
||||
LOG.info("Got error when processing perfect overwrite, path={} " +
|
||||
"error: {}", path, e.toString());
|
||||
return new WRITE3Response(Nfs3Status.NFS3ERR_IO, wccData, 0, stableHow,
|
||||
Nfs3Constant.WRITE_COMMIT_VERF);
|
||||
}
|
||||
|
@ -810,9 +777,7 @@ class OpenFileCtx {
|
|||
|
||||
COMMIT_STATUS ret = checkCommitInternal(commitOffset, channel, xid,
|
||||
preOpAttr, fromRead);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Got commit status: " + ret.name());
|
||||
}
|
||||
LOG.debug("Got commit status: {}", ret.name());
|
||||
// Do the sync outside the lock
|
||||
if (ret == COMMIT_STATUS.COMMIT_DO_SYNC
|
||||
|| ret == COMMIT_STATUS.COMMIT_FINISHED) {
|
||||
|
@ -828,7 +793,7 @@ class OpenFileCtx {
|
|||
ret = COMMIT_STATUS.COMMIT_ERROR;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("Got stream error during data sync: " + e);
|
||||
LOG.error("Got stream error during data sync", e);
|
||||
// Do nothing. Stream will be closed eventually by StreamMonitor.
|
||||
// status = Nfs3Status.NFS3ERR_IO;
|
||||
ret = COMMIT_STATUS.COMMIT_ERROR;
|
||||
|
@ -867,9 +832,7 @@ class OpenFileCtx {
|
|||
CommitCtx commitCtx = new CommitCtx(commitOffset, channel, xid, preOpAttr);
|
||||
pendingCommits.put(commitOffset, commitCtx);
|
||||
}
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("return COMMIT_SPECIAL_WAIT");
|
||||
}
|
||||
return COMMIT_STATUS.COMMIT_SPECIAL_WAIT;
|
||||
}
|
||||
|
||||
|
@ -886,10 +849,8 @@ class OpenFileCtx {
|
|||
}
|
||||
|
||||
long flushed = getFlushedOffset();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("getFlushedOffset=" + flushed + " commitOffset=" + commitOffset
|
||||
+ "nextOffset=" + nextOffset.get());
|
||||
}
|
||||
LOG.debug("getFlushedOffset={} commitOffset={} nextOffset={}",
|
||||
flushed, commitOffset, nextOffset.get());
|
||||
|
||||
if (pendingWrites.isEmpty()) {
|
||||
if (aixCompatMode) {
|
||||
|
@ -898,10 +859,8 @@ class OpenFileCtx {
|
|||
return COMMIT_STATUS.COMMIT_FINISHED;
|
||||
} else {
|
||||
if (flushed < nextOffset.get()) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("get commit while still writing to the requested offset,"
|
||||
+ " with empty queue");
|
||||
}
|
||||
return handleSpecialWait(fromRead, nextOffset.get(), channel, xid,
|
||||
preOpAttr);
|
||||
} else {
|
||||
|
@ -920,18 +879,14 @@ class OpenFileCtx {
|
|||
if (co <= flushed) {
|
||||
return COMMIT_STATUS.COMMIT_DO_SYNC;
|
||||
} else if (co < nextOffset.get()) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("get commit while still writing to the requested offset");
|
||||
}
|
||||
return handleSpecialWait(fromRead, co, channel, xid, preOpAttr);
|
||||
} else {
|
||||
// co >= nextOffset
|
||||
if (checkSequential(co, nextOffset.get())) {
|
||||
return handleSpecialWait(fromRead, co, channel, xid, preOpAttr);
|
||||
} else {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("return COMMIT_SPECIAL_SUCCESS");
|
||||
}
|
||||
return COMMIT_STATUS.COMMIT_SPECIAL_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -993,8 +948,8 @@ class OpenFileCtx {
|
|||
// Check the stream timeout
|
||||
if (checkStreamTimeout(streamTimeout)) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("stream can be closed for fileId: "
|
||||
+ handle.dumpFileHandle());
|
||||
LOG.debug("stream can be closed for fileId: {}",
|
||||
handle.dumpFileHandle());
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
|
@ -1009,10 +964,8 @@ class OpenFileCtx {
|
|||
*/
|
||||
private synchronized WriteCtx offerNextToWrite() {
|
||||
if (pendingWrites.isEmpty()) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("The async write task has no pending writes, fileId: "
|
||||
+ latestAttr.getFileId());
|
||||
}
|
||||
LOG.debug("The async write task has no pending writes, fileId: {}",
|
||||
latestAttr.getFileId());
|
||||
// process pending commit again to handle this race: a commit is added
|
||||
// to pendingCommits map just after the last doSingleWrite returns.
|
||||
// There is no pending write and the commit should be handled by the
|
||||
|
@ -1029,49 +982,35 @@ class OpenFileCtx {
|
|||
OffsetRange range = lastEntry.getKey();
|
||||
WriteCtx toWrite = lastEntry.getValue();
|
||||
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("range.getMin()=" + range.getMin() + " nextOffset="
|
||||
+ nextOffset);
|
||||
}
|
||||
LOG.trace("range.getMin()={} nextOffset={}",
|
||||
range.getMin(), nextOffset);
|
||||
|
||||
long offset = nextOffset.get();
|
||||
if (range.getMin() > offset) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("The next sequential write has not arrived yet");
|
||||
}
|
||||
processCommits(nextOffset.get()); // handle race
|
||||
this.asyncStatus = false;
|
||||
} else if (range.getMax() <= offset) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Remove write " + range.toString()
|
||||
+ " which is already written from the list");
|
||||
}
|
||||
LOG.debug("Remove write {} which is already written from the list",
|
||||
range);
|
||||
// remove the WriteCtx from cache
|
||||
pendingWrites.remove(range);
|
||||
} else if (range.getMin() < offset && range.getMax() > offset) {
|
||||
LOG.warn("Got an overlapping write " + range.toString()
|
||||
+ ", nextOffset=" + offset
|
||||
+ ". Remove and trim it");
|
||||
LOG.warn("Got an overlapping write {}, nextOffset={}. " +
|
||||
"Remove and trim it", range, offset);
|
||||
pendingWrites.remove(range);
|
||||
trimWriteRequest(toWrite, offset);
|
||||
// update nextOffset
|
||||
nextOffset.addAndGet(toWrite.getCount());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Change nextOffset (after trim) to " + nextOffset.get());
|
||||
}
|
||||
LOG.debug("Change nextOffset (after trim) to {}", nextOffset.get());
|
||||
return toWrite;
|
||||
} else {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Remove write " + range.toString()
|
||||
+ " from the list");
|
||||
}
|
||||
LOG.debug("Remove write {} from the list", range);
|
||||
// after writing, remove the WriteCtx from cache
|
||||
pendingWrites.remove(range);
|
||||
// update nextOffset
|
||||
nextOffset.addAndGet(toWrite.getCount());
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Change nextOffset to " + nextOffset.get());
|
||||
}
|
||||
LOG.debug("Change nextOffset to {}", nextOffset.get());
|
||||
return toWrite;
|
||||
}
|
||||
return null;
|
||||
|
@ -1095,9 +1034,9 @@ class OpenFileCtx {
|
|||
}
|
||||
}
|
||||
|
||||
if (!activeState && LOG.isDebugEnabled()) {
|
||||
LOG.debug("The openFileCtx is not active anymore, fileId: "
|
||||
+ latestAttr.getFileId());
|
||||
if (!activeState) {
|
||||
LOG.debug("The openFileCtx is not active anymore, fileId: {}",
|
||||
latestAttr.getFileId());
|
||||
}
|
||||
} finally {
|
||||
// Make sure to reset asyncStatus to false unless a race happens
|
||||
|
@ -1105,11 +1044,12 @@ class OpenFileCtx {
|
|||
if (startOffset == asyncWriteBackStartOffset) {
|
||||
asyncStatus = false;
|
||||
} else {
|
||||
LOG.info("Another async task is already started before this one"
|
||||
+ " is finalized. fileId: " + latestAttr.getFileId()
|
||||
+ " asyncStatus: " + asyncStatus + " original startOffset: "
|
||||
+ startOffset + " new startOffset: " + asyncWriteBackStartOffset
|
||||
+ ". Won't change asyncStatus here.");
|
||||
LOG.info("Another async task is already started before this one " +
|
||||
"is finalized. fileId: {} asyncStatus: {} " +
|
||||
"original startOffset: {} " +
|
||||
"new startOffset: {}. Won't change asyncStatus here.",
|
||||
latestAttr.getFileId(), asyncStatus,
|
||||
startOffset, asyncWriteBackStartOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1132,8 +1072,8 @@ class OpenFileCtx {
|
|||
status = Nfs3Status.NFS3_OK;
|
||||
} catch (ClosedChannelException cce) {
|
||||
if (!pendingWrites.isEmpty()) {
|
||||
LOG.error("Can't sync for fileId: " + latestAttr.getFileId()
|
||||
+ ". Channel closed with writes pending.", cce);
|
||||
LOG.error("Can't sync for fileId: {}. " +
|
||||
"Channel closed with writes pending", latestAttr.getFileId(), cce);
|
||||
}
|
||||
status = Nfs3Status.NFS3ERR_IO;
|
||||
} catch (IOException e) {
|
||||
|
@ -1152,8 +1092,8 @@ class OpenFileCtx {
|
|||
}
|
||||
|
||||
if (latestAttr.getSize() != offset) {
|
||||
LOG.error("After sync, the expect file size: " + offset
|
||||
+ ", however actual file size is: " + latestAttr.getSize());
|
||||
LOG.error("After sync, the expect file size: {}, " +
|
||||
"however actual file size is: {}", offset, latestAttr.getSize());
|
||||
status = Nfs3Status.NFS3ERR_IO;
|
||||
}
|
||||
WccData wccData = new WccData(Nfs3Utils.getWccAttr(latestAttr), latestAttr);
|
||||
|
@ -1172,9 +1112,9 @@ class OpenFileCtx {
|
|||
new VerifierNone()), commit.getXid());
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("FileId: " + latestAttr.getFileId() + " Service time: "
|
||||
+ Nfs3Utils.getElapsedTime(commit.startTime)
|
||||
+ "ns. Sent response for commit: " + commit);
|
||||
LOG.debug("FileId: {} Service time: {}ns. " +
|
||||
"Sent response for commit: {}", latestAttr.getFileId(),
|
||||
Nfs3Utils.getElapsedTime(commit.startTime), commit);
|
||||
}
|
||||
entry = pendingCommits.firstEntry();
|
||||
}
|
||||
|
@ -1190,8 +1130,8 @@ class OpenFileCtx {
|
|||
|
||||
FileHandle handle = writeCtx.getHandle();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("do write, fileHandle " + handle.dumpFileHandle() + " offset: "
|
||||
+ offset + " length: " + count + " stableHow: " + stableHow.name());
|
||||
LOG.debug("do write, fileHandle {} offset: {} length: {} stableHow: {}",
|
||||
handle.dumpFileHandle(), offset, count, stableHow.name());
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -1215,10 +1155,10 @@ class OpenFileCtx {
|
|||
writeCtx.setDataState(WriteCtx.DataState.NO_DUMP);
|
||||
updateNonSequentialWriteInMemory(-count);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("After writing " + handle.dumpFileHandle()
|
||||
+ " at offset " + offset
|
||||
+ ", updated the memory count, new value: "
|
||||
+ nonSequentialWriteInMemory.get());
|
||||
LOG.debug("After writing {} at offset {}, " +
|
||||
"updated the memory count, new value: {}",
|
||||
handle.dumpFileHandle(), offset,
|
||||
nonSequentialWriteInMemory.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1226,7 +1166,7 @@ class OpenFileCtx {
|
|||
|
||||
if (!writeCtx.getReplied()) {
|
||||
if (stableHow != WriteStableHow.UNSTABLE) {
|
||||
LOG.info("Do sync for stable write: " + writeCtx);
|
||||
LOG.info("Do sync for stable write: {}", writeCtx);
|
||||
try {
|
||||
if (stableHow == WriteStableHow.DATA_SYNC) {
|
||||
fos.hsync();
|
||||
|
@ -1237,7 +1177,7 @@ class OpenFileCtx {
|
|||
fos.hsync(EnumSet.of(SyncFlag.UPDATE_LENGTH));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("hsync failed with writeCtx: " + writeCtx, e);
|
||||
LOG.error("hsync failed with writeCtx: {}", writeCtx, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -1245,8 +1185,8 @@ class OpenFileCtx {
|
|||
WccAttr preOpAttr = latestAttr.getWccAttr();
|
||||
WccData fileWcc = new WccData(preOpAttr, latestAttr);
|
||||
if (writeCtx.getOriginalCount() != WriteCtx.INVALID_ORIGINAL_COUNT) {
|
||||
LOG.warn("Return original count: " + writeCtx.getOriginalCount()
|
||||
+ " instead of real data count: " + count);
|
||||
LOG.warn("Return original count: {} instead of real data count: {}",
|
||||
writeCtx.getOriginalCount(), count);
|
||||
count = writeCtx.getOriginalCount();
|
||||
}
|
||||
WRITE3Response response = new WRITE3Response(Nfs3Status.NFS3_OK,
|
||||
|
@ -1260,8 +1200,8 @@ class OpenFileCtx {
|
|||
processCommits(writeCtx.getOffset() + writeCtx.getCount());
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.error("Error writing to fileHandle " + handle.dumpFileHandle()
|
||||
+ " at offset " + offset + " and length " + count, e);
|
||||
LOG.error("Error writing to fileHandle {} at offset {} and length {}",
|
||||
handle.dumpFileHandle(), offset, count, e);
|
||||
if (!writeCtx.getReplied()) {
|
||||
WRITE3Response response = new WRITE3Response(Nfs3Status.NFS3ERR_IO);
|
||||
Nfs3Utils.writeChannel(channel, response.serialize(
|
||||
|
@ -1269,8 +1209,8 @@ class OpenFileCtx {
|
|||
// Keep stream open. Either client retries or SteamMonitor closes it.
|
||||
}
|
||||
|
||||
LOG.info("Clean up open file context for fileId: "
|
||||
+ latestAttr.getFileId());
|
||||
LOG.info("Clean up open file context for fileId: {}",
|
||||
latestAttr.getFileId());
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
@ -1297,17 +1237,16 @@ class OpenFileCtx {
|
|||
fos.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.info("Can't close stream for fileId: " + latestAttr.getFileId()
|
||||
+ ", error: " + e);
|
||||
LOG.info("Can't close stream for fileId: {}, error: {}",
|
||||
latestAttr.getFileId(), e.toString());
|
||||
}
|
||||
|
||||
// Reply error for pending writes
|
||||
LOG.info("There are " + pendingWrites.size() + " pending writes.");
|
||||
LOG.info("There are {} pending writes.", pendingWrites.size());
|
||||
WccAttr preOpAttr = latestAttr.getWccAttr();
|
||||
while (!pendingWrites.isEmpty()) {
|
||||
OffsetRange key = pendingWrites.firstKey();
|
||||
LOG.info("Fail pending write: " + key.toString()
|
||||
+ ", nextOffset=" + nextOffset.get());
|
||||
LOG.info("Fail pending write: {}, nextOffset={}", key, nextOffset.get());
|
||||
|
||||
WriteCtx writeCtx = pendingWrites.remove(key);
|
||||
if (!writeCtx.getReplied()) {
|
||||
|
@ -1325,11 +1264,12 @@ class OpenFileCtx {
|
|||
try {
|
||||
dumpOut.close();
|
||||
} catch (IOException e) {
|
||||
LOG.error("Failed to close outputstream of dump file" + dumpFilePath, e);
|
||||
LOG.error("Failed to close outputstream of dump file {}",
|
||||
dumpFilePath, e);
|
||||
}
|
||||
File dumpFile = new File(dumpFilePath);
|
||||
if (dumpFile.exists() && !dumpFile.delete()) {
|
||||
LOG.error("Failed to delete dumpfile: " + dumpFile);
|
||||
LOG.error("Failed to delete dumpfile: {}", dumpFile);
|
||||
}
|
||||
}
|
||||
if (raf != null) {
|
||||
|
|
|
@ -28,8 +28,6 @@ import java.nio.ByteBuffer;
|
|||
import java.nio.charset.Charset;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
||||
import org.apache.hadoop.fs.CreateFlag;
|
||||
import org.apache.hadoop.fs.DirectoryListingStartAfterNotFoundException;
|
||||
|
@ -137,6 +135,8 @@ import org.jboss.netty.channel.Channel;
|
|||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* RPC program corresponding to nfs daemon. See {@link Nfs3}.
|
||||
|
@ -146,7 +146,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
public static final FsPermission umask = new FsPermission(
|
||||
(short) DEFAULT_UMASK);
|
||||
|
||||
static final Log LOG = LogFactory.getLog(RpcProgramNfs3.class);
|
||||
static final Logger LOG = LoggerFactory.getLogger(RpcProgramNfs3.class);
|
||||
|
||||
private final NfsConfiguration config;
|
||||
private final WriteManager writeManager;
|
||||
|
@ -204,7 +204,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
NfsConfigKeys.DFS_NFS_KERBEROS_PRINCIPAL_KEY);
|
||||
superuser = config.get(NfsConfigKeys.NFS_SUPERUSER_KEY,
|
||||
NfsConfigKeys.NFS_SUPERUSER_DEFAULT);
|
||||
LOG.info("Configured HDFS superuser is " + superuser);
|
||||
LOG.info("Configured HDFS superuser is {}", superuser);
|
||||
|
||||
if (!enableDump) {
|
||||
writeDumpDir = null;
|
||||
|
@ -230,13 +230,13 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
private void clearDirectory(String writeDumpDir) throws IOException {
|
||||
File dumpDir = new File(writeDumpDir);
|
||||
if (dumpDir.exists()) {
|
||||
LOG.info("Delete current dump directory " + writeDumpDir);
|
||||
LOG.info("Delete current dump directory {}", writeDumpDir);
|
||||
if (!(FileUtil.fullyDelete(dumpDir))) {
|
||||
throw new IOException("Cannot remove current dump directory: "
|
||||
+ dumpDir);
|
||||
}
|
||||
}
|
||||
LOG.info("Create new dump directory " + writeDumpDir);
|
||||
LOG.info("Create new dump directory {}", writeDumpDir);
|
||||
if (!dumpDir.mkdirs()) {
|
||||
throw new IOException("Cannot create dump directory " + dumpDir);
|
||||
}
|
||||
|
@ -298,9 +298,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
|
||||
@Override
|
||||
public NFS3Response nullProcedure() {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS NULL");
|
||||
}
|
||||
return new NFS3Response(Nfs3Status.NFS3_OK);
|
||||
}
|
||||
|
||||
|
@ -331,10 +329,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
FileHandle handle = request.getHandle();
|
||||
int namenodeId = handle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("GETATTR for fileHandle: " + handle.dumpFileHandle()
|
||||
+ " client: " + remoteAddress);
|
||||
LOG.debug("GETATTR for fileHandle: {} client: {}",
|
||||
handle.dumpFileHandle(), remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -357,13 +354,13 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
return new GETATTR3Response(Nfs3Status.NFS3ERR_IO);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.info("Can't get file attribute, fileId=" + handle.getFileId(), e);
|
||||
LOG.info("Can't get file attribute, fileId={}", handle.getFileId(), e);
|
||||
int status = mapErrorStatus(e);
|
||||
response.setStatus(status);
|
||||
return response;
|
||||
}
|
||||
if (attrs == null) {
|
||||
LOG.error("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.error("Can't get path for fileId: {}", handle.getFileId());
|
||||
response.setStatus(Nfs3Status.NFS3ERR_STALE);
|
||||
return response;
|
||||
}
|
||||
|
@ -378,9 +375,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
EnumSet<SetAttrField> updateFields = newAttr.getUpdateFields();
|
||||
|
||||
if (setMode && updateFields.contains(SetAttrField.MODE)) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("set new mode: " + newAttr.getMode());
|
||||
}
|
||||
LOG.debug("set new mode: {}", newAttr.getMode());
|
||||
dfsClient.setPermission(fileIdPath,
|
||||
new FsPermission((short) (newAttr.getMode())));
|
||||
}
|
||||
|
@ -398,9 +393,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
long mtime = updateFields.contains(SetAttrField.MTIME) ? newAttr.getMtime()
|
||||
.getMilliSeconds() : -1;
|
||||
if (atime != -1 || mtime != -1) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("set atime: " + +atime + " mtime: " + mtime);
|
||||
}
|
||||
LOG.debug("set atime: {} mtime: {}", atime, mtime);
|
||||
dfsClient.setTimes(fileIdPath, mtime, atime);
|
||||
}
|
||||
}
|
||||
|
@ -427,10 +420,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
FileHandle handle = request.getHandle();
|
||||
int namenodeId = handle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS SETATTR fileHandle: " + handle.dumpFileHandle()
|
||||
+ " client: " + remoteAddress);
|
||||
LOG.debug("NFS SETATTR fileHandle: {} client: {}",
|
||||
handle.dumpFileHandle(), remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -439,8 +431,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
}
|
||||
|
||||
if (request.getAttr().getUpdateFields().contains(SetAttrField.SIZE)) {
|
||||
LOG.error("Setting file size is not supported when setattr, fileId: "
|
||||
+ handle.getFileId());
|
||||
LOG.error("Setting file size is not supported when setattr, fileId: {}",
|
||||
handle.getFileId());
|
||||
response.setStatus(Nfs3Status.NFS3ERR_INVAL);
|
||||
return response;
|
||||
}
|
||||
|
@ -450,7 +442,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
preOpAttr = Nfs3Utils.getFileAttr(dfsClient, fileIdPath, iug);
|
||||
if (preOpAttr == null) {
|
||||
LOG.info("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.info("Can't get path for fileId: {}", handle.getFileId());
|
||||
response.setStatus(Nfs3Status.NFS3ERR_STALE);
|
||||
return response;
|
||||
}
|
||||
|
@ -480,7 +472,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
wccData = Nfs3Utils.createWccData(Nfs3Utils.getWccAttr(preOpAttr),
|
||||
dfsClient, fileIdPath, iug);
|
||||
} catch (IOException e1) {
|
||||
LOG.info("Can't get postOpAttr for fileIdPath: " + fileIdPath, e1);
|
||||
LOG.info("Can't get postOpAttr for fileIdPath: {}", fileIdPath, e1);
|
||||
}
|
||||
|
||||
int status = mapErrorStatus(e);
|
||||
|
@ -515,10 +507,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
String fileName = request.getName();
|
||||
int namenodeId = dirHandle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS LOOKUP dir fileHandle: " + dirHandle.dumpFileHandle()
|
||||
+ " name: " + fileName + " client: " + remoteAddress);
|
||||
LOG.debug("NFS LOOKUP dir fileHandle: {} name: {} client: {}",
|
||||
dirHandle.dumpFileHandle(), fileName, remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -530,10 +521,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
Nfs3FileAttributes postOpObjAttr = writeManager.getFileAttr(dfsClient,
|
||||
dirHandle, fileName, namenodeId);
|
||||
if (postOpObjAttr == null) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS LOOKUP fileId: " + dirHandle.getFileId() + " name: "
|
||||
+ fileName + " does not exist");
|
||||
}
|
||||
LOG.debug("NFS LOOKUP fileId: {} name: {} does not exist",
|
||||
dirHandle.getFileId(), fileName);
|
||||
Nfs3FileAttributes postOpDirAttr = Nfs3Utils.getFileAttr(dfsClient,
|
||||
dirFileIdPath, iug);
|
||||
return new LOOKUP3Response(Nfs3Status.NFS3ERR_NOENT, null, null,
|
||||
|
@ -543,7 +532,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
Nfs3FileAttributes postOpDirAttr = Nfs3Utils.getFileAttr(dfsClient,
|
||||
dirFileIdPath, iug);
|
||||
if (postOpDirAttr == null) {
|
||||
LOG.info("Can't get path for dir fileId: " + dirHandle.getFileId());
|
||||
LOG.info("Can't get path for dir fileId: {}", dirHandle.getFileId());
|
||||
return new LOOKUP3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
FileHandle fileHandle =
|
||||
|
@ -592,16 +581,15 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS ACCESS fileHandle: " + handle.dumpFileHandle()
|
||||
+ " client: " + remoteAddress);
|
||||
LOG.debug("NFS ACCESS fileHandle: {} client: {}",
|
||||
handle.dumpFileHandle(), remoteAddress);
|
||||
}
|
||||
|
||||
Nfs3FileAttributes attrs;
|
||||
try {
|
||||
attrs = writeManager.getFileAttr(dfsClient, handle, iug);
|
||||
|
||||
if (attrs == null) {
|
||||
LOG.error("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.error("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new ACCESS3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
if(iug.getUserName(securityHandler.getUid(), "unknown").equals(superuser)) {
|
||||
|
@ -660,10 +648,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
FileHandle handle = request.getHandle();
|
||||
int namenodeId = handle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS READLINK fileHandle: " + handle.dumpFileHandle()
|
||||
+ " client: " + remoteAddress);
|
||||
LOG.debug("NFS READLINK fileHandle: {} client: {}",
|
||||
handle.dumpFileHandle(), remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -678,24 +665,23 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
Nfs3FileAttributes postOpAttr = Nfs3Utils.getFileAttr(dfsClient,
|
||||
fileIdPath, iug);
|
||||
if (postOpAttr == null) {
|
||||
LOG.info("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.info("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new READLINK3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
if (postOpAttr.getType() != NfsFileType.NFSLNK.toValue()) {
|
||||
LOG.error("Not a symlink, fileId: " + handle.getFileId());
|
||||
LOG.error("Not a symlink, fileId: {}", handle.getFileId());
|
||||
return new READLINK3Response(Nfs3Status.NFS3ERR_INVAL);
|
||||
}
|
||||
if (target == null) {
|
||||
LOG.error("Symlink target should not be null, fileId: "
|
||||
+ handle.getFileId());
|
||||
LOG.error("Symlink target should not be null, fileId: {}",
|
||||
handle.getFileId());
|
||||
return new READLINK3Response(Nfs3Status.NFS3ERR_SERVERFAULT);
|
||||
}
|
||||
int rtmax = config.getInt(NfsConfigKeys.DFS_NFS_MAX_READ_TRANSFER_SIZE_KEY,
|
||||
NfsConfigKeys.DFS_NFS_MAX_READ_TRANSFER_SIZE_DEFAULT);
|
||||
if (rtmax < target.getBytes(Charset.forName("UTF-8")).length) {
|
||||
LOG.error("Link size: "
|
||||
+ target.getBytes(Charset.forName("UTF-8")).length
|
||||
+ " is larger than max transfer size: " + rtmax);
|
||||
LOG.error("Link size: {} is larger than max transfer size: {}",
|
||||
target.getBytes(Charset.forName("UTF-8")).length, rtmax);
|
||||
return new READLINK3Response(Nfs3Status.NFS3ERR_IO, postOpAttr,
|
||||
new byte[0]);
|
||||
}
|
||||
|
@ -704,7 +690,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
target.getBytes(Charset.forName("UTF-8")));
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Readlink error: " + e.getClass(), e);
|
||||
LOG.warn("Readlink error", e);
|
||||
int status = mapErrorStatus(e);
|
||||
return new READLINK3Response(status);
|
||||
}
|
||||
|
@ -741,10 +727,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
FileHandle handle = request.getHandle();
|
||||
int namenodeId = handle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS READ fileHandle: " + handle.dumpFileHandle()+ " offset: "
|
||||
+ offset + " count: " + count + " client: " + remoteAddress);
|
||||
LOG.debug("NFS READ fileHandle: {} offset: {} count: {} client: {}",
|
||||
handle.dumpFileHandle(), offset, count, remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient = clientCache.getDfsClient(userName, namenodeId);
|
||||
if (dfsClient == null) {
|
||||
response.setStatus(Nfs3Status.NFS3ERR_SERVERFAULT);
|
||||
|
@ -760,15 +745,12 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
attrs = Nfs3Utils.getFileAttr(dfsClient,
|
||||
Nfs3Utils.getFileIdPath(handle), iug);
|
||||
} catch (IOException e) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Get error accessing file, fileId: " + handle.getFileId(), e);
|
||||
}
|
||||
LOG.debug("Get error accessing file, fileId: {}",
|
||||
handle.getFileId(), e);
|
||||
return new READ3Response(Nfs3Status.NFS3ERR_IO);
|
||||
}
|
||||
if (attrs == null) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Can't get path for fileId: " + handle.getFileId());
|
||||
}
|
||||
LOG.debug("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new READ3Response(Nfs3Status.NFS3ERR_NOENT);
|
||||
}
|
||||
int access = Nfs3Utils.getAccessRightsForUserGroup(
|
||||
|
@ -787,8 +769,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
// optimized later by reading from the cache.
|
||||
int ret = writeManager.commitBeforeRead(dfsClient, handle, offset + count);
|
||||
if (ret != Nfs3Status.NFS3_OK) {
|
||||
LOG.warn("commitBeforeRead didn't succeed with ret=" + ret
|
||||
+ ". Read may not get most recent data.");
|
||||
LOG.warn("commitBeforeRead didn't succeed with ret={}. " +
|
||||
"Read may not get most recent data.", ret);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -828,9 +810,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
attrs = Nfs3Utils.getFileAttr(dfsClient, Nfs3Utils.getFileIdPath(handle),
|
||||
iug);
|
||||
if (readCount < count) {
|
||||
LOG.info("Partial read. Asked offset: " + offset + " count: " + count
|
||||
+ " and read back: " + readCount + " file size: "
|
||||
+ attrs.getSize());
|
||||
LOG.info("Partial read. Asked offset: {} count: {} and read back: {} " +
|
||||
"file size: {}", offset, count, readCount, attrs.getSize());
|
||||
}
|
||||
// HDFS returns -1 for read beyond file size.
|
||||
if (readCount < 0) {
|
||||
|
@ -841,8 +822,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
ByteBuffer.wrap(readbuffer));
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Read error: " + e.getClass() + " offset: " + offset
|
||||
+ " count: " + count, e);
|
||||
LOG.warn("Read error. Offset: {} count: {}", offset, count, e);
|
||||
int status = mapErrorStatus(e);
|
||||
return new READ3Response(status);
|
||||
}
|
||||
|
@ -884,11 +864,11 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
FileHandle handle = request.getHandle();
|
||||
int namenodeId = handle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS WRITE fileHandle: " + handle.dumpFileHandle() + " offset: "
|
||||
+ offset + " length: " + count + " stableHow: " + stableHow.getValue()
|
||||
+ " xid: " + xid + " client: " + remoteAddress);
|
||||
LOG.debug("NFS WRITE fileHandle: {} offset: {} length: {} " +
|
||||
"stableHow: {} xid: {} client: {}",
|
||||
handle.dumpFileHandle(), offset, count, stableHow.getValue(), xid,
|
||||
remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -900,7 +880,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
preOpAttr = writeManager.getFileAttr(dfsClient, handle, iug);
|
||||
if (preOpAttr == null) {
|
||||
LOG.error("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.error("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new WRITE3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
|
@ -910,22 +890,20 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
Nfs3Constant.WRITE_COMMIT_VERF);
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("requested offset=" + offset + " and current filesize="
|
||||
+ preOpAttr.getSize());
|
||||
}
|
||||
LOG.debug("requested offset={} and current filesize={}",
|
||||
offset, preOpAttr.getSize());
|
||||
|
||||
writeManager.handleWrite(dfsClient, request, channel, xid, preOpAttr);
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.info("Error writing to fileId " + handle.getFileId() + " at offset "
|
||||
+ offset + " and length " + data.length, e);
|
||||
LOG.info("Error writing to fileId {} at offset {} and length {}",
|
||||
handle.getFileId(), offset, data.length, e);
|
||||
// Try to return WccData
|
||||
Nfs3FileAttributes postOpAttr = null;
|
||||
try {
|
||||
postOpAttr = writeManager.getFileAttr(dfsClient, handle, iug);
|
||||
} catch (IOException e1) {
|
||||
LOG.info("Can't get postOpAttr for fileId: " + handle.getFileId(), e1);
|
||||
LOG.info("Can't get postOpAttr for fileId: {}", e1);
|
||||
}
|
||||
WccAttr attr = preOpAttr == null ? null : Nfs3Utils.getWccAttr(preOpAttr);
|
||||
WccData fileWcc = new WccData(attr, postOpAttr);
|
||||
|
@ -961,10 +939,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
String fileName = request.getName();
|
||||
int namenodeId = dirHandle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS CREATE dir fileHandle: " + dirHandle.dumpFileHandle()
|
||||
+ " filename: " + fileName + " client: " + remoteAddress);
|
||||
LOG.debug("NFS CREATE dir fileHandle: {} filename: {} client: {}",
|
||||
dirHandle.dumpFileHandle(), fileName, remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -976,8 +953,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
if ((createMode != Nfs3Constant.CREATE_EXCLUSIVE)
|
||||
&& request.getObjAttr().getUpdateFields().contains(SetAttrField.SIZE)
|
||||
&& request.getObjAttr().getSize() != 0) {
|
||||
LOG.error("Setting file size is not supported when creating file: "
|
||||
+ fileName + " dir fileId: " + dirHandle.getFileId());
|
||||
LOG.error("Setting file size is not supported when creating file: {} " +
|
||||
"dir fileId: {}", fileName, dirHandle.getFileId());
|
||||
return new CREATE3Response(Nfs3Status.NFS3ERR_INVAL);
|
||||
}
|
||||
|
||||
|
@ -990,7 +967,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
preOpDirAttr = Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug);
|
||||
if (preOpDirAttr == null) {
|
||||
LOG.error("Can't get path for dirHandle: " + dirHandle);
|
||||
LOG.error("Can't get path for dirHandle: {}", dirHandle);
|
||||
return new CREATE3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
|
@ -1041,10 +1018,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
fos.close();
|
||||
fos = null;
|
||||
} else {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Opened stream for file: " + fileName + ", fileId: "
|
||||
+ fileHandle.getFileId());
|
||||
}
|
||||
LOG.debug("Opened stream for file: {}, fileId: {}",
|
||||
fileName, fileHandle.getFileId());
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
|
@ -1053,8 +1028,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
fos.close();
|
||||
} catch (IOException e1) {
|
||||
LOG.error("Can't close stream for dirFileId: " + dirHandle.getFileId()
|
||||
+ " filename: " + fileName, e1);
|
||||
LOG.error("Can't close stream for dirFileId: {} filename: {}",
|
||||
dirHandle.getFileId(), fileName, e1);
|
||||
}
|
||||
}
|
||||
if (dirWcc == null) {
|
||||
|
@ -1062,8 +1037,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
dirWcc = Nfs3Utils.createWccData(Nfs3Utils.getWccAttr(preOpDirAttr),
|
||||
dfsClient, dirFileIdPath, iug);
|
||||
} catch (IOException e1) {
|
||||
LOG.error("Can't get postOpDirAttr for dirFileId: "
|
||||
+ dirHandle.getFileId(), e1);
|
||||
LOG.error("Can't get postOpDirAttr for dirFileId: {}",
|
||||
dirHandle.getFileId(), e1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1105,13 +1080,12 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS MKDIR dirHandle: " + dirHandle.dumpFileHandle()
|
||||
+ " filename: " + fileName + " client: " + remoteAddress);
|
||||
LOG.debug("NFS MKDIR dirHandle: {} filename: {} client: {}",
|
||||
dirHandle.dumpFileHandle(), fileName, remoteAddress);
|
||||
}
|
||||
|
||||
if (request.getObjAttr().getUpdateFields().contains(SetAttrField.SIZE)) {
|
||||
LOG.error("Setting file size is not supported when mkdir: " + fileName
|
||||
+ " in dirHandle" + dirHandle);
|
||||
LOG.error("Setting file size is not supported when mkdir: " +
|
||||
"{} in dirHandle {}", fileName, dirHandle);
|
||||
return new MKDIR3Response(Nfs3Status.NFS3ERR_INVAL);
|
||||
}
|
||||
|
||||
|
@ -1123,7 +1097,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
preOpDirAttr = Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug);
|
||||
if (preOpDirAttr == null) {
|
||||
LOG.info("Can't get path for dir fileId: " + dirHandle.getFileId());
|
||||
LOG.info("Can't get path for dir fileId: {}", dirHandle.getFileId());
|
||||
return new MKDIR3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
|
@ -1164,7 +1138,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
postOpDirAttr = Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug);
|
||||
} catch (IOException e1) {
|
||||
LOG.info("Can't get postOpDirAttr for " + dirFileIdPath, e);
|
||||
LOG.info("Can't get postOpDirAttr for {}", dirFileIdPath, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1202,10 +1176,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
|
||||
String fileName = request.getName();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS REMOVE dir fileHandle: " + dirHandle.dumpFileHandle()
|
||||
+ " fileName: " + fileName + " client: " + remoteAddress);
|
||||
LOG.debug("NFS REMOVE dir fileHandle: {} fileName: {} client: {}",
|
||||
dirHandle.dumpFileHandle(), fileName, remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -1219,7 +1192,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
preOpDirAttr = Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug);
|
||||
if (preOpDirAttr == null) {
|
||||
LOG.info("Can't get path for dir fileId: " + dirHandle.getFileId());
|
||||
LOG.info("Can't get path for dir fileId: {}", dirHandle.getFileId());
|
||||
return new REMOVE3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
|
@ -1253,7 +1226,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
postOpDirAttr = Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug);
|
||||
} catch (IOException e1) {
|
||||
LOG.info("Can't get postOpDirAttr for " + dirFileIdPath, e1);
|
||||
LOG.info("Can't get postOpDirAttr for {}", dirFileIdPath, e1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1285,10 +1258,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
String fileName = request.getName();
|
||||
int namenodeId = dirHandle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS RMDIR dir fileHandle: " + dirHandle.dumpFileHandle()
|
||||
+ " fileName: " + fileName + " client: " + remoteAddress);
|
||||
LOG.debug("NFS RMDIR dir fileHandle: {} fileName: {} client: {}",
|
||||
dirHandle.dumpFileHandle(), fileName, remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -1302,7 +1274,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
preOpDirAttr = Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug);
|
||||
if (preOpDirAttr == null) {
|
||||
LOG.info("Can't get path for dir fileId: " + dirHandle.getFileId());
|
||||
LOG.info("Can't get path for dir fileId: {}", dirHandle.getFileId());
|
||||
return new RMDIR3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
|
@ -1340,7 +1312,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
postOpDirAttr = Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug);
|
||||
} catch (IOException e1) {
|
||||
LOG.info("Can't get postOpDirAttr for " + dirFileIdPath, e1);
|
||||
LOG.info("Can't get postOpDirAttr for {}", dirFileIdPath, e1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1376,11 +1348,10 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
int toNamenodeId = toHandle.getNamenodeId();
|
||||
String toName = request.getToName();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS RENAME from: " + fromHandle.dumpFileHandle()
|
||||
+ "/" + fromName + " to: " + toHandle.dumpFileHandle()
|
||||
+ "/" + toName + " client: " + remoteAddress);
|
||||
LOG.debug("NFS RENAME from: {}/{} to: {}/{} client: {}",
|
||||
fromHandle.dumpFileHandle(), fromName, toHandle.dumpFileHandle(),
|
||||
toName, remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), fromNamenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -1403,14 +1374,15 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
fromPreOpAttr = Nfs3Utils.getFileAttr(dfsClient, fromDirFileIdPath, iug);
|
||||
if (fromPreOpAttr == null) {
|
||||
LOG.info("Can't get path for fromHandle fileId: "
|
||||
+ fromHandle.getFileId());
|
||||
LOG.info("Can't get path for fromHandle fileId: {}",
|
||||
fromHandle.getFileId());
|
||||
return new RENAME3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
toPreOpAttr = Nfs3Utils.getFileAttr(dfsClient, toDirFileIdPath, iug);
|
||||
if (toPreOpAttr == null) {
|
||||
LOG.info("Can't get path for toHandle fileId: " + toHandle.getFileId());
|
||||
LOG.info("Can't get path for toHandle fileId: {}",
|
||||
toHandle.getFileId());
|
||||
return new RENAME3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
|
@ -1443,8 +1415,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
toDirWcc = Nfs3Utils.createWccData(Nfs3Utils.getWccAttr(toPreOpAttr),
|
||||
dfsClient, toDirFileIdPath, iug);
|
||||
} catch (IOException e1) {
|
||||
LOG.info("Can't get postOpDirAttr for " + fromDirFileIdPath + " or"
|
||||
+ toDirFileIdPath, e1);
|
||||
LOG.info("Can't get postOpDirAttr for {} or {}",
|
||||
fromDirFileIdPath, toDirFileIdPath, e1);
|
||||
}
|
||||
|
||||
int status = mapErrorStatus(e);
|
||||
|
@ -1484,10 +1456,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
|
||||
// Don't do any name check to source path, just leave it to HDFS
|
||||
String linkIdPath = linkDirIdPath + "/" + name;
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS SYMLINK, target: " + symData + " link: " + linkIdPath
|
||||
+ " namenodeId: " + namenodeId + " client: " + remoteAddress);
|
||||
}
|
||||
LOG.debug("NFS SYMLINK, target: {} link: {} namenodeId: {} client: {}",
|
||||
symData, linkIdPath, namenodeId, remoteAddress);
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
|
@ -1515,7 +1485,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
objAttr.getFileId(), namenodeId), objAttr, dirWcc);
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Exception: " + e);
|
||||
LOG.warn("Exception", e);
|
||||
int status = mapErrorStatus(e);
|
||||
response.setStatus(status);
|
||||
return response;
|
||||
|
@ -1542,9 +1512,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
throw io;
|
||||
}
|
||||
// This happens when startAfter was just deleted
|
||||
LOG.info("Cookie couldn't be found: "
|
||||
+ new String(startAfter, Charset.forName("UTF-8"))
|
||||
+ ", do listing from beginning");
|
||||
LOG.info("Cookie couldn't be found: {}, do listing from beginning",
|
||||
new String(startAfter, Charset.forName("UTF-8")));
|
||||
dlisting = dfsClient
|
||||
.listPaths(dirFileIdPath, HdfsFileStatus.EMPTY_NAME);
|
||||
}
|
||||
|
@ -1577,21 +1546,19 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
|
||||
long cookie = request.getCookie();
|
||||
if (cookie < 0) {
|
||||
LOG.error("Invalid READDIR request, with negative cookie: " + cookie);
|
||||
LOG.error("Invalid READDIR request, with negative cookie: {}", cookie);
|
||||
return new READDIR3Response(Nfs3Status.NFS3ERR_INVAL);
|
||||
}
|
||||
long count = request.getCount();
|
||||
if (count <= 0) {
|
||||
LOG.info("Nonpositive count in invalid READDIR request: " + count);
|
||||
LOG.info("Nonpositive count in invalid READDIR request: {}", count);
|
||||
return new READDIR3Response(Nfs3Status.NFS3_OK);
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS READDIR fileHandle: " + handle.dumpFileHandle()
|
||||
+ " cookie: " + cookie + " count: " + count + " client: "
|
||||
+ remoteAddress);
|
||||
LOG.debug("NFS READDIR fileHandle: {} cookie: {} count: {} client: {}",
|
||||
handle.dumpFileHandle(), cookie, count, remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -1607,12 +1574,12 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
String dirFileIdPath = Nfs3Utils.getFileIdPath(handle);
|
||||
dirStatus = dfsClient.getFileInfo(dirFileIdPath);
|
||||
if (dirStatus == null) {
|
||||
LOG.info("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.info("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new READDIR3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
if (!dirStatus.isDirectory()) {
|
||||
LOG.error("Can't readdir for regular file, fileId: "
|
||||
+ handle.getFileId());
|
||||
LOG.error("Can't readdir for regular file, fileId: {}",
|
||||
handle.getFileId());
|
||||
return new READDIR3Response(Nfs3Status.NFS3ERR_NOTDIR);
|
||||
}
|
||||
long cookieVerf = request.getCookieVerf();
|
||||
|
@ -1631,8 +1598,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
LOG.warn("AIX compatibility mode enabled, ignoring cookieverf " +
|
||||
"mismatches.");
|
||||
} else {
|
||||
LOG.error("CookieVerf mismatch. request cookieVerf: " + cookieVerf
|
||||
+ " dir cookieVerf: " + dirStatus.getModificationTime());
|
||||
LOG.error("CookieVerf mismatch. request cookieVerf: {} " +
|
||||
"dir cookieVerf: {}",
|
||||
cookieVerf, dirStatus.getModificationTime());
|
||||
return new READDIR3Response(
|
||||
Nfs3Status.NFS3ERR_BAD_COOKIE,
|
||||
Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug));
|
||||
|
@ -1664,7 +1632,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
dlisting = listPaths(dfsClient, dirFileIdPath, startAfter);
|
||||
postOpAttr = Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug);
|
||||
if (postOpAttr == null) {
|
||||
LOG.error("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.error("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new READDIR3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -1742,26 +1710,28 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
int namenodeId = handle.getNamenodeId();
|
||||
long cookie = request.getCookie();
|
||||
if (cookie < 0) {
|
||||
LOG.error("Invalid READDIRPLUS request, with negative cookie: " + cookie);
|
||||
LOG.error("Invalid READDIRPLUS request, with negative cookie: {}",
|
||||
cookie);
|
||||
return new READDIRPLUS3Response(Nfs3Status.NFS3ERR_INVAL);
|
||||
}
|
||||
long dirCount = request.getDirCount();
|
||||
if (dirCount <= 0) {
|
||||
LOG.info("Nonpositive dircount in invalid READDIRPLUS request: " + dirCount);
|
||||
LOG.info("Nonpositive dircount in invalid READDIRPLUS request: {}",
|
||||
dirCount);
|
||||
return new READDIRPLUS3Response(Nfs3Status.NFS3ERR_INVAL);
|
||||
}
|
||||
int maxCount = request.getMaxCount();
|
||||
if (maxCount <= 0) {
|
||||
LOG.info("Nonpositive maxcount in invalid READDIRPLUS request: " + maxCount);
|
||||
LOG.info("Nonpositive maxcount in invalid READDIRPLUS request: {}",
|
||||
maxCount);
|
||||
return new READDIRPLUS3Response(Nfs3Status.NFS3ERR_INVAL);
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS READDIRPLUS fileHandle: " + handle.dumpFileHandle()
|
||||
+ " cookie: " + cookie + " dirCount: " + dirCount + " maxCount: "
|
||||
+ maxCount + " client: " + remoteAddress);
|
||||
LOG.debug("NFS READDIRPLUS fileHandle: {} cookie: {} dirCount: {} " +
|
||||
"maxCount: {} client: {}",
|
||||
handle.dumpFileHandle(), cookie, dirCount, maxCount, remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -1777,12 +1747,12 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
String dirFileIdPath = Nfs3Utils.getFileIdPath(handle);
|
||||
dirStatus = dfsClient.getFileInfo(dirFileIdPath);
|
||||
if (dirStatus == null) {
|
||||
LOG.info("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.info("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new READDIRPLUS3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
if (!dirStatus.isDirectory()) {
|
||||
LOG.error("Can't readdirplus for regular file, fileId: "
|
||||
+ handle.getFileId());
|
||||
LOG.error("Can't readdirplus for regular file, fileId: {}",
|
||||
handle.getFileId());
|
||||
return new READDIRPLUS3Response(Nfs3Status.NFS3ERR_NOTDIR);
|
||||
}
|
||||
long cookieVerf = request.getCookieVerf();
|
||||
|
@ -1799,8 +1769,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
LOG.warn("AIX compatibility mode enabled, ignoring cookieverf " +
|
||||
"mismatches.");
|
||||
} else {
|
||||
LOG.error("cookieverf mismatch. request cookieverf: " + cookieVerf
|
||||
+ " dir cookieverf: " + dirStatus.getModificationTime());
|
||||
LOG.error("cookieverf mismatch. request cookieverf: {} " +
|
||||
"dir cookieverf: {}",
|
||||
cookieVerf, dirStatus.getModificationTime());
|
||||
return new READDIRPLUS3Response(
|
||||
Nfs3Status.NFS3ERR_BAD_COOKIE,
|
||||
Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug),
|
||||
|
@ -1833,7 +1804,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
dlisting = listPaths(dfsClient, dirFileIdPath, startAfter);
|
||||
postOpDirAttr = Nfs3Utils.getFileAttr(dfsClient, dirFileIdPath, iug);
|
||||
if (postOpDirAttr == null) {
|
||||
LOG.info("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.info("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new READDIRPLUS3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -1865,7 +1836,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
attr = writeManager.getFileAttr(dfsClient, childHandle, iug);
|
||||
} catch (IOException e) {
|
||||
LOG.error("Can't get file attributes for fileId: " + fileId, e);
|
||||
LOG.error("Can't get file attributes for fileId: {}", fileId, e);
|
||||
continue;
|
||||
}
|
||||
entries[i] = new READDIRPLUS3Response.EntryPlus3(fileId,
|
||||
|
@ -1882,7 +1853,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
attr = writeManager.getFileAttr(dfsClient, childHandle, iug);
|
||||
} catch (IOException e) {
|
||||
LOG.error("Can't get file attributes for fileId: " + fileId, e);
|
||||
LOG.error("Can't get file attributes for fileId: {}", fileId, e);
|
||||
continue;
|
||||
}
|
||||
entries[i] = new READDIRPLUS3Response.EntryPlus3(fileId,
|
||||
|
@ -1923,10 +1894,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
FileHandle handle = request.getHandle();
|
||||
int namenodeId = handle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS FSSTAT fileHandle: " + handle.dumpFileHandle()
|
||||
+ " client: " + remoteAddress);
|
||||
LOG.debug("NFS FSSTAT fileHandle: {} client: {}",
|
||||
handle.dumpFileHandle(), remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -1942,7 +1912,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
Nfs3FileAttributes attrs = writeManager.getFileAttr(dfsClient, handle,
|
||||
iug);
|
||||
if (attrs == null) {
|
||||
LOG.info("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.info("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new FSSTAT3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
|
@ -2000,10 +1970,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
FileHandle handle = request.getHandle();
|
||||
int namenodeId = handle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS FSINFO fileHandle: " + handle.dumpFileHandle()
|
||||
+" client: " + remoteAddress);
|
||||
LOG.debug("NFS FSINFO fileHandle: {} client: {}", remoteAddress,
|
||||
handle.dumpFileHandle(), remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -2025,7 +1994,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
Nfs3FileAttributes attrs = Nfs3Utils.getFileAttr(dfsClient,
|
||||
Nfs3Utils.getFileIdPath(handle), iug);
|
||||
if (attrs == null) {
|
||||
LOG.info("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.info("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new FSINFO3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
|
@ -2069,10 +2038,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
int namenodeId = handle.getNamenodeId();
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS PATHCONF fileHandle: " + handle.dumpFileHandle()
|
||||
+ " client: " + remoteAddress);
|
||||
LOG.debug("NFS PATHCONF fileHandle: {} client: {}",
|
||||
handle.dumpFileHandle(), remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -2084,7 +2052,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
attrs = Nfs3Utils.getFileAttr(dfsClient, Nfs3Utils.getFileIdPath(handle),
|
||||
iug);
|
||||
if (attrs == null) {
|
||||
LOG.info("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.info("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new PATHCONF3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
|
@ -2123,11 +2091,10 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
FileHandle handle = request.getHandle();
|
||||
int namenodeId = handle.getNamenodeId();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("NFS COMMIT fileHandle: " + handle.dumpFileHandle() + " offset="
|
||||
+ request.getOffset() + " count=" + request.getCount() + " client: "
|
||||
+ remoteAddress);
|
||||
LOG.debug("NFS COMMIT fileHandle: {} offset={} count={} client: {}",
|
||||
handle.dumpFileHandle(), request.getOffset(), request.getCount(),
|
||||
remoteAddress);
|
||||
}
|
||||
|
||||
DFSClient dfsClient =
|
||||
clientCache.getDfsClient(securityHandler.getUser(), namenodeId);
|
||||
if (dfsClient == null) {
|
||||
|
@ -2140,7 +2107,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
preOpAttr = Nfs3Utils.getFileAttr(dfsClient, fileIdPath, iug);
|
||||
if (preOpAttr == null) {
|
||||
LOG.info("Can't get path for fileId: " + handle.getFileId());
|
||||
LOG.info("Can't get path for fileId: {}", handle.getFileId());
|
||||
return new COMMIT3Response(Nfs3Status.NFS3ERR_STALE);
|
||||
}
|
||||
|
||||
|
@ -2163,7 +2130,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
try {
|
||||
postOpAttr = writeManager.getFileAttr(dfsClient, handle, iug);
|
||||
} catch (IOException e1) {
|
||||
LOG.info("Can't get postOpAttr for fileId: " + handle.getFileId(), e1);
|
||||
LOG.info("Can't get postOpAttr for fileId: {}", handle.getFileId(), e1);
|
||||
}
|
||||
|
||||
WccData fileWcc = new WccData(Nfs3Utils.getWccAttr(preOpAttr), postOpAttr);
|
||||
|
@ -2205,8 +2172,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
if (nfsproc3 != NFSPROC3.NULL) {
|
||||
if (credentials.getFlavor() != AuthFlavor.AUTH_SYS
|
||||
&& credentials.getFlavor() != AuthFlavor.RPCSEC_GSS) {
|
||||
LOG.info("Wrong RPC AUTH flavor, " + credentials.getFlavor()
|
||||
+ " is not AUTH_SYS or RPCSEC_GSS.");
|
||||
LOG.info("Wrong RPC AUTH flavor, {} is not AUTH_SYS or RPCSEC_GSS.",
|
||||
credentials.getFlavor());
|
||||
XDR reply = new XDR();
|
||||
RpcDeniedReply rdr = new RpcDeniedReply(xid,
|
||||
RpcReply.ReplyState.MSG_ACCEPTED,
|
||||
|
@ -2226,12 +2193,13 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
xid);
|
||||
if (entry != null) { // in cache
|
||||
if (entry.isCompleted()) {
|
||||
LOG.info("Sending the cached reply to retransmitted request " + xid);
|
||||
LOG.info("Sending the cached reply to retransmitted request {}",
|
||||
xid);
|
||||
RpcUtil.sendRpcResponse(ctx, entry.getResponse());
|
||||
return;
|
||||
} else { // else request is in progress
|
||||
LOG.info("Retransmitted request, transaction still in progress "
|
||||
+ xid);
|
||||
LOG.info("Retransmitted request, transaction still in progress {}",
|
||||
xid);
|
||||
// Ignore the request and do nothing
|
||||
return;
|
||||
}
|
||||
|
@ -2261,18 +2229,12 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
response = readlink(xdr, info);
|
||||
metrics.addReadlink(Nfs3Utils.getElapsedTime(startTime));
|
||||
} else if (nfsproc3 == NFSPROC3.READ) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(Nfs3Utils.READ_RPC_START + xid);
|
||||
}
|
||||
LOG.debug("{}{}", Nfs3Utils.READ_RPC_START, xid);
|
||||
response = read(xdr, info);
|
||||
if (LOG.isDebugEnabled() && (nfsproc3 == NFSPROC3.READ)) {
|
||||
LOG.debug(Nfs3Utils.READ_RPC_END + xid);
|
||||
}
|
||||
LOG.debug("{}{}", Nfs3Utils.READ_RPC_END, xid);
|
||||
metrics.addRead(Nfs3Utils.getElapsedTime(startTime));
|
||||
} else if (nfsproc3 == NFSPROC3.WRITE) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(Nfs3Utils.WRITE_RPC_START + xid);
|
||||
}
|
||||
LOG.debug("{}{}", Nfs3Utils.WRITE_RPC_START, xid);
|
||||
response = write(xdr, info);
|
||||
// Write end debug trace is in Nfs3Utils.writeChannel
|
||||
} else if (nfsproc3 == NFSPROC3.CREATE) {
|
||||
|
@ -2323,10 +2285,8 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
|||
out);
|
||||
}
|
||||
if (response == null) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("No sync response, expect an async response for request XID="
|
||||
+ rpcCall.getXid());
|
||||
}
|
||||
LOG.debug("No sync response, expect an async response for request XID={}",
|
||||
rpcCall.getXid());
|
||||
return;
|
||||
}
|
||||
// TODO: currently we just return VerifierNone
|
||||
|
|
|
@ -477,7 +477,7 @@ public class DataNode extends ReconfigurableBase
|
|||
HdfsClientConfigKeys.Read.ShortCircuit.DEFAULT)) {
|
||||
String reason = DomainSocket.getLoadingFailureReason();
|
||||
if (reason != null) {
|
||||
LOG.warn("File descriptor passing is disabled because " + reason);
|
||||
LOG.warn("File descriptor passing is disabled because {}", reason);
|
||||
this.fileDescriptorPassingDisabledReason = reason;
|
||||
} else {
|
||||
LOG.info("File descriptor passing is enabled.");
|
||||
|
@ -493,7 +493,7 @@ public class DataNode extends ReconfigurableBase
|
|||
|
||||
try {
|
||||
hostName = getHostName(conf);
|
||||
LOG.info("Configured hostname is " + hostName);
|
||||
LOG.info("Configured hostname is {}", hostName);
|
||||
startDataNode(dataDirs, resources);
|
||||
} catch (IOException ie) {
|
||||
shutdown();
|
||||
|
@ -533,7 +533,7 @@ public class DataNode extends ReconfigurableBase
|
|||
case DFS_DATANODE_DATA_DIR_KEY: {
|
||||
IOException rootException = null;
|
||||
try {
|
||||
LOG.info("Reconfiguring " + property + " to " + newVal);
|
||||
LOG.info("Reconfiguring {} to {}", property, newVal);
|
||||
this.refreshVolumes(newVal);
|
||||
return getConf().get(DFS_DATANODE_DATA_DIR_KEY);
|
||||
} catch (IOException e) {
|
||||
|
@ -545,7 +545,7 @@ public class DataNode extends ReconfigurableBase
|
|||
new BlockReportOptions.Factory().setIncremental(false).build());
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Exception while sending the block report after refreshing"
|
||||
+ " volumes " + property + " to " + newVal, e);
|
||||
+ " volumes {} to {}", property, newVal, e);
|
||||
if (rootException == null) {
|
||||
rootException = e;
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ public class DataNode extends ReconfigurableBase
|
|||
case DFS_DATANODE_BALANCE_MAX_NUM_CONCURRENT_MOVES_KEY: {
|
||||
ReconfigurationException rootException = null;
|
||||
try {
|
||||
LOG.info("Reconfiguring " + property + " to " + newVal);
|
||||
LOG.info("Reconfiguring {} to {}", property, newVal);
|
||||
int movers;
|
||||
if (newVal == null) {
|
||||
// set to default
|
||||
|
@ -696,8 +696,8 @@ public class DataNode extends ReconfigurableBase
|
|||
// New conf doesn't have the storage location which available in
|
||||
// the current storage locations. Add to the deactivateLocations list.
|
||||
if (!found) {
|
||||
LOG.info("Deactivation request received for active volume: "
|
||||
+ dir.getRoot().toString());
|
||||
LOG.info("Deactivation request received for active volume: {}",
|
||||
dir.getRoot());
|
||||
results.deactivateLocations.add(
|
||||
StorageLocation.parse(dir.getRoot().toString()));
|
||||
}
|
||||
|
@ -724,8 +724,8 @@ public class DataNode extends ReconfigurableBase
|
|||
// New conf doesn't have this failed storage location.
|
||||
// Add to the deactivate locations list.
|
||||
if (!found) {
|
||||
LOG.info("Deactivation request received for failed volume: "
|
||||
+ failedStorageLocation);
|
||||
LOG.info("Deactivation request received for failed volume: {}",
|
||||
failedStorageLocation);
|
||||
results.deactivateLocations.add(StorageLocation.parse(
|
||||
failedStorageLocation));
|
||||
}
|
||||
|
@ -760,7 +760,7 @@ public class DataNode extends ReconfigurableBase
|
|||
throw new IOException("Attempt to remove all volumes.");
|
||||
}
|
||||
if (!changedVolumes.newLocations.isEmpty()) {
|
||||
LOG.info("Adding new volumes: " +
|
||||
LOG.info("Adding new volumes: {}",
|
||||
Joiner.on(",").join(changedVolumes.newLocations));
|
||||
|
||||
// Add volumes for each Namespace
|
||||
|
@ -794,16 +794,16 @@ public class DataNode extends ReconfigurableBase
|
|||
errorMessageBuilder.append(
|
||||
String.format("FAILED TO ADD: %s: %s%n",
|
||||
volume, ioe.getMessage()));
|
||||
LOG.error("Failed to add volume: " + volume, ioe);
|
||||
LOG.error("Failed to add volume: {}", volume, ioe);
|
||||
} else {
|
||||
effectiveVolumes.add(volume.toString());
|
||||
LOG.info("Successfully added volume: " + volume);
|
||||
LOG.info("Successfully added volume: {}", volume);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errorMessageBuilder.append(
|
||||
String.format("FAILED to ADD: %s: %s%n", volume,
|
||||
e.toString()));
|
||||
LOG.error("Failed to add volume: " + volume, e);
|
||||
LOG.error("Failed to add volume: {}", volume, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -812,7 +812,7 @@ public class DataNode extends ReconfigurableBase
|
|||
removeVolumes(changedVolumes.deactivateLocations);
|
||||
} catch (IOException e) {
|
||||
errorMessageBuilder.append(e.getMessage());
|
||||
LOG.error("Failed to remove volume: " + e.getMessage(), e);
|
||||
LOG.error("Failed to remove volume", e);
|
||||
}
|
||||
|
||||
if (errorMessageBuilder.length() > 0) {
|
||||
|
@ -967,16 +967,17 @@ public class DataNode extends ReconfigurableBase
|
|||
ServicePlugin.class);
|
||||
} catch (RuntimeException e) {
|
||||
String pluginsValue = conf.get(DFS_DATANODE_PLUGINS_KEY);
|
||||
LOG.error("Unable to load DataNode plugins. Specified list of plugins: " +
|
||||
LOG.error("Unable to load DataNode plugins. " +
|
||||
"Specified list of plugins: {}",
|
||||
pluginsValue, e);
|
||||
throw e;
|
||||
}
|
||||
for (ServicePlugin p: plugins) {
|
||||
try {
|
||||
p.start(this);
|
||||
LOG.info("Started plug-in " + p);
|
||||
LOG.info("Started plug-in {}", p);
|
||||
} catch (Throwable t) {
|
||||
LOG.warn("ServicePlugin " + p + " could not be started", t);
|
||||
LOG.warn("ServicePlugin {} could not be started", p, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1026,7 +1027,7 @@ public class DataNode extends ReconfigurableBase
|
|||
traceAdminService,
|
||||
ipcServer);
|
||||
|
||||
LOG.info("Opened IPC server at " + ipcServer.getListenerAddress());
|
||||
LOG.info("Opened IPC server at {}", ipcServer.getListenerAddress());
|
||||
|
||||
// set service-level authorization security policy
|
||||
if (getConf().getBoolean(
|
||||
|
@ -1085,7 +1086,8 @@ public class DataNode extends ReconfigurableBase
|
|||
directoryScanner = new DirectoryScanner(this, data, conf);
|
||||
directoryScanner.start();
|
||||
} else {
|
||||
LOG.info("Periodic Directory Tree Verification scan is disabled because " +
|
||||
LOG.info("Periodic Directory Tree Verification scan " +
|
||||
"is disabled because {}",
|
||||
reason);
|
||||
}
|
||||
}
|
||||
|
@ -1139,7 +1141,7 @@ public class DataNode extends ReconfigurableBase
|
|||
dnConf.getTransferSocketRecvBufferSize());
|
||||
}
|
||||
streamingAddr = tcpPeerServer.getStreamingAddr();
|
||||
LOG.info("Opened streaming server at " + streamingAddr);
|
||||
LOG.info("Opened streaming server at {}", streamingAddr);
|
||||
this.threadGroup = new ThreadGroup("dataXceiverServer");
|
||||
xserver = new DataXceiverServer(tcpPeerServer, getConf(), this);
|
||||
this.dataXceiverServer = new Daemon(threadGroup, xserver);
|
||||
|
@ -1157,7 +1159,7 @@ public class DataNode extends ReconfigurableBase
|
|||
if (domainPeerServer != null) {
|
||||
this.localDataXceiverServer = new Daemon(threadGroup,
|
||||
new DataXceiverServer(domainPeerServer, getConf(), this));
|
||||
LOG.info("Listening on UNIX domain socket: " +
|
||||
LOG.info("Listening on UNIX domain socket: {}",
|
||||
domainPeerServer.getBindPath());
|
||||
}
|
||||
}
|
||||
|
@ -1175,7 +1177,7 @@ public class DataNode extends ReconfigurableBase
|
|||
(!conf.getBoolean(HdfsClientConfigKeys.DFS_CLIENT_USE_LEGACY_BLOCKREADERLOCAL,
|
||||
HdfsClientConfigKeys.DFS_CLIENT_USE_LEGACY_BLOCKREADERLOCAL_DEFAULT))) {
|
||||
LOG.warn("Although short-circuit local reads are configured, " +
|
||||
"they are disabled because you didn't configure " +
|
||||
"they are disabled because you didn't configure {}",
|
||||
DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY);
|
||||
}
|
||||
return null;
|
||||
|
@ -1205,8 +1207,8 @@ public class DataNode extends ReconfigurableBase
|
|||
bpos.notifyNamenodeReceivedBlock(block, delHint, storageUuid,
|
||||
isOnTransientStorage);
|
||||
} else {
|
||||
LOG.error("Cannot find BPOfferService for reporting block received for bpid="
|
||||
+ block.getBlockPoolId());
|
||||
LOG.error("Cannot find BPOfferService for reporting block received " +
|
||||
"for bpid={}", block.getBlockPoolId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1217,8 +1219,8 @@ public class DataNode extends ReconfigurableBase
|
|||
if(bpos != null) {
|
||||
bpos.notifyNamenodeReceivingBlock(block, storageUuid);
|
||||
} else {
|
||||
LOG.error("Cannot find BPOfferService for reporting block receiving for bpid="
|
||||
+ block.getBlockPoolId());
|
||||
LOG.error("Cannot find BPOfferService for reporting block receiving " +
|
||||
"for bpid={}", block.getBlockPoolId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1239,7 +1241,7 @@ public class DataNode extends ReconfigurableBase
|
|||
public void reportBadBlocks(ExtendedBlock block) throws IOException{
|
||||
FsVolumeSpi volume = getFSDataset().getVolume(block);
|
||||
if (volume == null) {
|
||||
LOG.warn("Cannot find FsVolumeSpi to report bad block: " + block);
|
||||
LOG.warn("Cannot find FsVolumeSpi to report bad block: {}", block);
|
||||
return;
|
||||
}
|
||||
reportBadBlocks(block, volume);
|
||||
|
@ -1382,7 +1384,7 @@ public class DataNode extends ReconfigurableBase
|
|||
}
|
||||
}
|
||||
}
|
||||
LOG.info("Starting DataNode with maxLockedMemory = " +
|
||||
LOG.info("Starting DataNode with maxLockedMemory = {}",
|
||||
dnConf.maxLockedMemory);
|
||||
|
||||
int volFailuresTolerated = dnConf.getVolFailuresTolerated();
|
||||
|
@ -1409,8 +1411,8 @@ public class DataNode extends ReconfigurableBase
|
|||
|
||||
// Login is done by now. Set the DN user name.
|
||||
dnUserName = UserGroupInformation.getCurrentUser().getUserName();
|
||||
LOG.info("dnUserName = " + dnUserName);
|
||||
LOG.info("supergroup = " + supergroup);
|
||||
LOG.info("dnUserName = {}", dnUserName);
|
||||
LOG.info("supergroup = {}", supergroup);
|
||||
initIpcServer();
|
||||
|
||||
metrics = DataNodeMetrics.create(getConf(), getDisplayName());
|
||||
|
@ -1514,7 +1516,7 @@ public class DataNode extends ReconfigurableBase
|
|||
if (storage.getDatanodeUuid() == null) {
|
||||
storage.setDatanodeUuid(generateUuid());
|
||||
storage.writeAll();
|
||||
LOG.info("Generated and persisted new Datanode UUID " +
|
||||
LOG.info("Generated and persisted new Datanode UUID {}",
|
||||
storage.getDatanodeUuid());
|
||||
}
|
||||
}
|
||||
|
@ -1583,11 +1585,11 @@ public class DataNode extends ReconfigurableBase
|
|||
if (!blockPoolTokenSecretManager.isBlockPoolRegistered(blockPoolId)) {
|
||||
long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
|
||||
long blockTokenLifetime = keys.getTokenLifetime();
|
||||
LOG.info("Block token params received from NN: for block pool " +
|
||||
blockPoolId + " keyUpdateInterval="
|
||||
+ blockKeyUpdateInterval / (60 * 1000)
|
||||
+ " min(s), tokenLifetime=" + blockTokenLifetime / (60 * 1000)
|
||||
+ " min(s)");
|
||||
LOG.info("Block token params received from NN: " +
|
||||
"for block pool {} keyUpdateInterval={} min(s), " +
|
||||
"tokenLifetime={} min(s)",
|
||||
blockPoolId, blockKeyUpdateInterval / (60 * 1000),
|
||||
blockTokenLifetime / (60 * 1000));
|
||||
final boolean enableProtobuf = getConf().getBoolean(
|
||||
DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_PROTOBUF_ENABLE,
|
||||
DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_PROTOBUF_ENABLE_DEFAULT);
|
||||
|
@ -1690,9 +1692,10 @@ public class DataNode extends ReconfigurableBase
|
|||
storage.recoverTransitionRead(this, nsInfo, dataDirs, startOpt);
|
||||
}
|
||||
final StorageInfo bpStorage = storage.getBPStorage(bpid);
|
||||
LOG.info("Setting up storage: nsid=" + bpStorage.getNamespaceID()
|
||||
+ ";bpid=" + bpid + ";lv=" + storage.getLayoutVersion()
|
||||
+ ";nsInfo=" + nsInfo + ";dnuuid=" + storage.getDatanodeUuid());
|
||||
LOG.info("Setting up storage: nsid={};bpid={};lv={};" +
|
||||
"nsInfo={};dnuuid={}",
|
||||
bpStorage.getNamespaceID(), bpid, storage.getLayoutVersion(),
|
||||
nsInfo, storage.getDatanodeUuid());
|
||||
}
|
||||
|
||||
// If this is a newly formatted DataNode then assign a new DatanodeUuid.
|
||||
|
@ -1802,9 +1805,8 @@ public class DataNode extends ReconfigurableBase
|
|||
final boolean connectToDnViaHostname) throws IOException {
|
||||
final String dnAddr = datanodeid.getIpcAddr(connectToDnViaHostname);
|
||||
final InetSocketAddress addr = NetUtils.createSocketAddr(dnAddr);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Connecting to datanode " + dnAddr + " addr=" + addr);
|
||||
}
|
||||
LOG.debug("Connecting to datanode {} addr={}",
|
||||
dnAddr, addr);
|
||||
final UserGroupInformation loginUgi = UserGroupInformation.getLoginUser();
|
||||
try {
|
||||
return loginUgi
|
||||
|
@ -1868,20 +1870,15 @@ public class DataNode extends ReconfigurableBase
|
|||
checkBlockToken(block, token, BlockTokenIdentifier.AccessMode.READ);
|
||||
Preconditions.checkNotNull(data, "Storage not yet initialized");
|
||||
BlockLocalPathInfo info = data.getBlockLocalPathInfo(block);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
if (info != null) {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("getBlockLocalPathInfo successful block=" + block
|
||||
+ " blockfile " + info.getBlockPath() + " metafile "
|
||||
+ info.getMetaPath());
|
||||
}
|
||||
LOG.trace("getBlockLocalPathInfo successful " +
|
||||
"block={} blockfile {} metafile {}",
|
||||
block, info.getBlockPath(), info.getMetaPath());
|
||||
} else {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("getBlockLocalPathInfo for block=" + block
|
||||
+ " returning null");
|
||||
}
|
||||
}
|
||||
LOG.trace("getBlockLocalPathInfo for block={} " +
|
||||
"returning null", block);
|
||||
}
|
||||
|
||||
metrics.incrBlocksGetLocalPathInfo();
|
||||
return info;
|
||||
}
|
||||
|
@ -1939,9 +1936,7 @@ public class DataNode extends ReconfigurableBase
|
|||
ByteArrayInputStream buf = new ByteArrayInputStream(token.getIdentifier());
|
||||
DataInputStream in = new DataInputStream(buf);
|
||||
id.readFields(in);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Got: " + id.toString());
|
||||
}
|
||||
LOG.debug("Got: {}", id);
|
||||
blockPoolTokenSecretManager.checkAccess(id, null, block, accessMode,
|
||||
null, null);
|
||||
}
|
||||
|
@ -1959,9 +1954,9 @@ public class DataNode extends ReconfigurableBase
|
|||
for (ServicePlugin p : plugins) {
|
||||
try {
|
||||
p.stop();
|
||||
LOG.info("Stopped plug-in " + p);
|
||||
LOG.info("Stopped plug-in {}", p);
|
||||
} catch (Throwable t) {
|
||||
LOG.warn("ServicePlugin " + p + " could not be stopped", t);
|
||||
LOG.warn("ServicePlugin {} could not be stopped", p, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1984,7 +1979,7 @@ public class DataNode extends ReconfigurableBase
|
|||
this.dataXceiverServer.interrupt();
|
||||
} catch (Exception e) {
|
||||
// Ignore, since the out of band messaging is advisory.
|
||||
LOG.trace("Exception interrupting DataXceiverServer: ", e);
|
||||
LOG.trace("Exception interrupting DataXceiverServer", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2038,7 +2033,7 @@ public class DataNode extends ReconfigurableBase
|
|||
this.threadGroup.interrupt();
|
||||
break;
|
||||
}
|
||||
LOG.info("Waiting for threadgroup to exit, active threads is " +
|
||||
LOG.info("Waiting for threadgroup to exit, active threads is {}",
|
||||
this.threadGroup.activeCount());
|
||||
if (this.threadGroup.activeCount() == 0) {
|
||||
break;
|
||||
|
@ -2085,7 +2080,7 @@ public class DataNode extends ReconfigurableBase
|
|||
try {
|
||||
this.blockPoolManager.shutDownAll(bposArray);
|
||||
} catch (InterruptedException ie) {
|
||||
LOG.warn("Received exception in BlockPoolManager#shutDownAll: ", ie);
|
||||
LOG.warn("Received exception in BlockPoolManager#shutDownAll", ie);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2093,7 +2088,7 @@ public class DataNode extends ReconfigurableBase
|
|||
try {
|
||||
this.storage.unlockAll();
|
||||
} catch (IOException ie) {
|
||||
LOG.warn("Exception when unlocking storage: " + ie, ie);
|
||||
LOG.warn("Exception when unlocking storage", ie);
|
||||
}
|
||||
}
|
||||
if (data != null) {
|
||||
|
@ -2140,8 +2135,8 @@ public class DataNode extends ReconfigurableBase
|
|||
|
||||
private void handleDiskError(String failedVolumes) {
|
||||
final boolean hasEnoughResources = data.hasEnoughResource();
|
||||
LOG.warn("DataNode.handleDiskError on : [" + failedVolumes +
|
||||
"] Keep Running: " + hasEnoughResources);
|
||||
LOG.warn("DataNode.handleDiskError on: " +
|
||||
"[{}] Keep Running: {}", failedVolumes, hasEnoughResources);
|
||||
|
||||
// If we have enough active valid volumes then we do not want to
|
||||
// shutdown the DN completely.
|
||||
|
@ -2438,15 +2433,13 @@ public class DataNode extends ReconfigurableBase
|
|||
String[] targetStorageIds, ExtendedBlock b,
|
||||
BlockConstructionStage stage, final String clientname) {
|
||||
if (DataTransferProtocol.LOG.isDebugEnabled()) {
|
||||
DataTransferProtocol.LOG.debug(getClass().getSimpleName() + ": "
|
||||
+ b + " (numBytes=" + b.getNumBytes() + ")"
|
||||
+ ", stage=" + stage
|
||||
+ ", clientname=" + clientname
|
||||
+ ", targets=" + Arrays.asList(targets)
|
||||
+ ", target storage types=" + (targetStorageTypes == null ? "[]" :
|
||||
Arrays.asList(targetStorageTypes))
|
||||
+ ", target storage IDs=" + (targetStorageIds == null ? "[]" :
|
||||
Arrays.asList(targetStorageIds)));
|
||||
DataTransferProtocol.LOG.debug("{}: {} (numBytes={}), stage={}, " +
|
||||
"clientname={}, targets={}, target storage types={}, " +
|
||||
"target storage IDs={}", getClass().getSimpleName(), b,
|
||||
b.getNumBytes(), stage, clientname, Arrays.asList(targets),
|
||||
targetStorageTypes == null ? "[]" :
|
||||
Arrays.asList(targetStorageTypes),
|
||||
targetStorageIds == null ? "[]" : Arrays.asList(targetStorageIds));
|
||||
}
|
||||
this.targets = targets;
|
||||
this.targetStorageTypes = targetStorageTypes;
|
||||
|
@ -2475,9 +2468,7 @@ public class DataNode extends ReconfigurableBase
|
|||
try {
|
||||
final String dnAddr = targets[0].getXferAddr(connectToDnViaHostname);
|
||||
InetSocketAddress curTarget = NetUtils.createSocketAddr(dnAddr);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Connecting to datanode " + dnAddr);
|
||||
}
|
||||
LOG.debug("Connecting to datanode {}", dnAddr);
|
||||
sock = newSocket();
|
||||
NetUtils.connect(sock, curTarget, dnConf.socketTimeout);
|
||||
sock.setTcpNoDelay(dnConf.getDataTransferServerTcpNoDelay());
|
||||
|
@ -2521,17 +2512,15 @@ public class DataNode extends ReconfigurableBase
|
|||
blockSender.sendBlock(out, unbufOut, null);
|
||||
|
||||
// no response necessary
|
||||
LOG.info(getClass().getSimpleName() + ", at "
|
||||
+ DataNode.this.getDisplayName() + ": Transmitted " + b
|
||||
+ " (numBytes=" + b.getNumBytes() + ") to " + curTarget);
|
||||
LOG.info("{}, at {}: Transmitted {} (numBytes={}) to {}",
|
||||
getClass().getSimpleName(), DataNode.this.getDisplayName(),
|
||||
b, b.getNumBytes(), curTarget);
|
||||
|
||||
// read ack
|
||||
if (isClient) {
|
||||
DNTransferAckProto closeAck = DNTransferAckProto.parseFrom(
|
||||
PBHelperClient.vintPrefixed(in));
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(getClass().getSimpleName() + ": close-ack=" + closeAck);
|
||||
}
|
||||
LOG.debug("{}: close-ack={}", getClass().getSimpleName(), closeAck);
|
||||
if (closeAck.getStatus() != Status.SUCCESS) {
|
||||
if (closeAck.getStatus() == Status.ERROR_ACCESS_TOKEN) {
|
||||
throw new InvalidBlockTokenException(
|
||||
|
@ -2550,17 +2539,11 @@ public class DataNode extends ReconfigurableBase
|
|||
// Add the block to the front of the scanning queue if metadata file
|
||||
// is corrupt. We already add the block to front of scanner if the
|
||||
// peer disconnects.
|
||||
LOG.info("Adding block: " + b + " for scanning");
|
||||
LOG.info("Adding block: {} for scanning", b);
|
||||
blockScanner.markSuspectBlock(data.getVolume(b).getStorageID(), b);
|
||||
}
|
||||
LOG.warn(bpReg + ":Failed to transfer " + b + " to " +
|
||||
targets[0] + " got ", ie);
|
||||
// disk check moved to FileIoProvider
|
||||
IOException cause = DatanodeUtil.getCauseIfDiskError(ie);
|
||||
if (cause != null) { // possible disk error
|
||||
LOG.warn("IOException in DataTransfer#run() "+ ie.getMessage() +". "
|
||||
+ "Cause is ", cause);
|
||||
}
|
||||
LOG.warn("{}:Failed to transfer {} to {} got",
|
||||
bpReg, b, targets[0], ie);
|
||||
} finally {
|
||||
decrementXmitsInProgress();
|
||||
IOUtils.closeStream(blockSender);
|
||||
|
@ -2691,14 +2674,9 @@ public class DataNode extends ReconfigurableBase
|
|||
final StorageLocation location;
|
||||
try {
|
||||
location = StorageLocation.parse(locationString);
|
||||
} catch (IOException ioe) {
|
||||
LOG.error("Failed to initialize storage directory " + locationString
|
||||
+ ". Exception details: " + ioe);
|
||||
// Ignore the exception.
|
||||
continue;
|
||||
} catch (SecurityException se) {
|
||||
LOG.error("Failed to initialize storage directory " + locationString
|
||||
+ ". Exception details: " + se);
|
||||
} catch (IOException | SecurityException ioe) {
|
||||
LOG.error("Failed to initialize storage directory {}." +
|
||||
"Exception details: {}", locationString, ioe.toString());
|
||||
// Ignore the exception.
|
||||
continue;
|
||||
}
|
||||
|
@ -2745,7 +2723,7 @@ public class DataNode extends ReconfigurableBase
|
|||
wait(2000);
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
LOG.warn("Received exception in Datanode#join: " + ex);
|
||||
LOG.warn("Received exception in Datanode#join: {}", ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2950,9 +2928,7 @@ public class DataNode extends ReconfigurableBase
|
|||
}
|
||||
for (TokenIdentifier tokenId : tokenIds) {
|
||||
BlockTokenIdentifier id = (BlockTokenIdentifier) tokenId;
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Got: " + id.toString());
|
||||
}
|
||||
LOG.debug("Got: {}", id);
|
||||
blockPoolTokenSecretManager.checkAccess(id, null, block,
|
||||
BlockTokenIdentifier.AccessMode.READ, null, null);
|
||||
}
|
||||
|
@ -3165,11 +3141,11 @@ public class DataNode extends ReconfigurableBase
|
|||
public void deleteBlockPool(String blockPoolId, boolean force)
|
||||
throws IOException {
|
||||
checkSuperuserPrivilege();
|
||||
LOG.info("deleteBlockPool command received for block pool " + blockPoolId
|
||||
+ ", force=" + force);
|
||||
LOG.info("deleteBlockPool command received for block pool {}, " +
|
||||
"force={}", blockPoolId, force);
|
||||
if (blockPoolManager.get(blockPoolId) != null) {
|
||||
LOG.warn("The block pool "+blockPoolId+
|
||||
" is still running, cannot be deleted.");
|
||||
LOG.warn("The block pool {} is still running, cannot be deleted.",
|
||||
blockPoolId);
|
||||
throw new IOException(
|
||||
"The block pool is still running. First do a refreshNamenodes to " +
|
||||
"shutdown the block pool service");
|
||||
|
@ -3181,8 +3157,8 @@ public class DataNode extends ReconfigurableBase
|
|||
@Override // ClientDatanodeProtocol
|
||||
public synchronized void shutdownDatanode(boolean forUpgrade) throws IOException {
|
||||
checkSuperuserPrivilege();
|
||||
LOG.info("shutdownDatanode command received (upgrade=" + forUpgrade +
|
||||
"). Shutting down Datanode...");
|
||||
LOG.info("shutdownDatanode command received (upgrade={}). " +
|
||||
"Shutting down Datanode...", forUpgrade);
|
||||
|
||||
// Shutdown can be called only once.
|
||||
if (shutdownInProgress) {
|
||||
|
@ -3381,12 +3357,9 @@ public class DataNode extends ReconfigurableBase
|
|||
// Remove all unhealthy volumes from DataNode.
|
||||
removeVolumes(unhealthyLocations, false);
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Error occurred when removing unhealthy storage dirs: "
|
||||
+ e.getMessage(), e);
|
||||
}
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(sb.toString());
|
||||
LOG.warn("Error occurred when removing unhealthy storage dirs", e);
|
||||
}
|
||||
LOG.debug("{}", sb);
|
||||
// send blockreport regarding volume failure
|
||||
handleDiskError(sb.toString());
|
||||
}
|
||||
|
@ -3568,7 +3541,7 @@ public class DataNode extends ReconfigurableBase
|
|||
case DiskBalancerConstants.DISKBALANCER_BANDWIDTH :
|
||||
return Long.toString(this.diskBalancer.getBandwidth());
|
||||
default:
|
||||
LOG.error("Disk Balancer - Unknown key in get balancer setting. Key: " +
|
||||
LOG.error("Disk Balancer - Unknown key in get balancer setting. Key: {}",
|
||||
key);
|
||||
throw new DiskBalancerException("Unknown key",
|
||||
DiskBalancerException.Result.UNKNOWN_KEY);
|
||||
|
|
|
@ -148,10 +148,8 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
(colonIdx < 0) ? remoteAddress : remoteAddress.substring(0, colonIdx);
|
||||
localAddress = peer.getLocalAddressString();
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Number of active connections is: "
|
||||
+ datanode.getXceiverCount());
|
||||
}
|
||||
LOG.debug("Number of active connections is: {}",
|
||||
datanode.getXceiverCount());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,7 +185,7 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
// This doesn't need to be in a critical section. Althogh the client
|
||||
// can resue the connection to issue a different request, trying sending
|
||||
// an OOB through the recently closed block receiver is harmless.
|
||||
LOG.info("Sending OOB to peer: " + peer);
|
||||
LOG.info("Sending OOB to peer: {}", peer);
|
||||
br.sendOOB();
|
||||
}
|
||||
|
||||
|
@ -199,7 +197,7 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
}
|
||||
xceiver.interrupt();
|
||||
}
|
||||
LOG.info("Stopped the writer: " + peer);
|
||||
LOG.info("Stopped the writer: {}", peer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -239,14 +237,15 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
} catch (InvalidMagicNumberException imne) {
|
||||
if (imne.isHandshake4Encryption()) {
|
||||
LOG.info("Failed to read expected encryption handshake from client " +
|
||||
"at " + peer.getRemoteAddressString() + ". Perhaps the client " +
|
||||
"at {}. Perhaps the client " +
|
||||
"is running an older version of Hadoop which does not support " +
|
||||
"encryption", imne);
|
||||
"encryption", peer.getRemoteAddressString(), imne);
|
||||
} else {
|
||||
LOG.info("Failed to read expected SASL data transfer protection " +
|
||||
"handshake from client at " + peer.getRemoteAddressString() +
|
||||
"handshake from client at {}" +
|
||||
". Perhaps the client is running an older version of Hadoop " +
|
||||
"which does not support SASL data transfer protection", imne);
|
||||
"which does not support SASL data transfer protection",
|
||||
peer.getRemoteAddressString(), imne);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -302,7 +301,7 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace(s, t);
|
||||
} else {
|
||||
LOG.info(s + "; " + t);
|
||||
LOG.info("{}; {}", s, t.toString());
|
||||
}
|
||||
} else if (op == Op.READ_BLOCK && t instanceof SocketTimeoutException) {
|
||||
String s1 =
|
||||
|
@ -311,23 +310,19 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace(s1, t);
|
||||
} else {
|
||||
LOG.info(s1 + "; " + t);
|
||||
LOG.info("{}; {}", s1, t.toString());
|
||||
}
|
||||
} else if (t instanceof InvalidToken) {
|
||||
// The InvalidToken exception has already been logged in
|
||||
// checkAccess() method and this is not a server error.
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace(s, t);
|
||||
}
|
||||
} else {
|
||||
LOG.error(s, t);
|
||||
}
|
||||
} finally {
|
||||
collectThreadLocalStates();
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(datanode.getDisplayName() + ":Number of active connections is: "
|
||||
+ datanode.getXceiverCount());
|
||||
}
|
||||
LOG.debug("{}:Number of active connections is: {}",
|
||||
datanode.getDisplayName(), datanode.getXceiverCount());
|
||||
updateCurrentThreadName("Cleaning up");
|
||||
if (peer != null) {
|
||||
dataXceiverServer.closePeer(peer);
|
||||
|
@ -405,21 +400,22 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
DomainSocket sock = peer.getDomainSocket();
|
||||
sock.sendFileDescriptors(fds, buf, 0, buf.length);
|
||||
if (supportsReceiptVerification) {
|
||||
LOG.trace("Reading receipt verification byte for " + slotId);
|
||||
LOG.trace("Reading receipt verification byte for {}", slotId);
|
||||
int val = sock.getInputStream().read();
|
||||
if (val < 0) {
|
||||
throw new EOFException();
|
||||
}
|
||||
} else {
|
||||
LOG.trace("Receipt verification is not enabled on the DataNode. " +
|
||||
"Not verifying " + slotId);
|
||||
"Not verifying {}", slotId);
|
||||
}
|
||||
success = true;
|
||||
}
|
||||
} finally {
|
||||
if ((!success) && (registeredSlotId != null)) {
|
||||
LOG.info("Unregistering " + registeredSlotId + " because the " +
|
||||
"requestShortCircuitFdsForRead operation failed.");
|
||||
LOG.info("Unregistering {} because the " +
|
||||
"requestShortCircuitFdsForRead operation failed.",
|
||||
registeredSlotId);
|
||||
datanode.shortCircuitRegistry.unregisterSlot(registeredSlotId);
|
||||
}
|
||||
if (ClientTraceLog.isInfoEnabled()) {
|
||||
|
@ -548,7 +544,7 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
// bad behavior inside the poll() call. See HADOOP-11802 for details.
|
||||
try {
|
||||
LOG.warn("Failed to send success response back to the client. " +
|
||||
"Shutting down socket for " + shmInfo.getShmId() + ".");
|
||||
"Shutting down socket for {}", shmInfo.getShmId());
|
||||
sock.shutdown();
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Failed to shut down socket in error handler", e);
|
||||
|
@ -616,9 +612,9 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
ClientReadStatusProto stat = ClientReadStatusProto.parseFrom(
|
||||
PBHelperClient.vintPrefixed(in));
|
||||
if (!stat.hasStatus()) {
|
||||
LOG.warn("Client " + peer.getRemoteAddressString() +
|
||||
" did not send a valid status code after reading. " +
|
||||
"Will close connection.");
|
||||
LOG.warn("Client {} did not send a valid status code " +
|
||||
"after reading. Will close connection.",
|
||||
peer.getRemoteAddressString());
|
||||
IOUtils.closeStream(out);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
|
@ -633,10 +629,8 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
datanode.metrics.incrBlocksRead();
|
||||
datanode.metrics.incrTotalReadTime(duration);
|
||||
} catch ( SocketException ignored ) {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace(dnR + ":Ignoring exception while serving " + block + " to " +
|
||||
remoteAddress, ignored);
|
||||
}
|
||||
LOG.trace("{}:Ignoring exception while serving {} to {}",
|
||||
dnR, block, remoteAddress, ignored);
|
||||
// Its ok for remote side to close the connection anytime.
|
||||
datanode.metrics.incrBlocksRead();
|
||||
IOUtils.closeStream(out);
|
||||
|
@ -645,8 +639,8 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
* Earlier version shutdown() datanode if there is disk error.
|
||||
*/
|
||||
if (!(ioe instanceof SocketTimeoutException)) {
|
||||
LOG.warn(dnR + ":Got exception while serving " + block + " to "
|
||||
+ remoteAddress, ioe);
|
||||
LOG.warn("{}:Got exception while serving {} to {}",
|
||||
dnR, block, remoteAddress, ioe);
|
||||
incrDatanodeNetworkErrors();
|
||||
}
|
||||
throw ioe;
|
||||
|
@ -721,17 +715,16 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("opWriteBlock: stage=" + stage + ", clientname=" + clientname
|
||||
+ "\n block =" + block + ", newGs=" + latestGenerationStamp
|
||||
+ ", bytesRcvd=[" + minBytesRcvd + ", " + maxBytesRcvd + "]"
|
||||
+ "\n targets=" + Arrays.asList(targets)
|
||||
+ "; pipelineSize=" + pipelineSize + ", srcDataNode=" + srcDataNode
|
||||
+ ", pinning=" + pinning);
|
||||
LOG.debug("isDatanode=" + isDatanode
|
||||
+ ", isClient=" + isClient
|
||||
+ ", isTransfer=" + isTransfer);
|
||||
LOG.debug("writeBlock receive buf size " + peer.getReceiveBufferSize() +
|
||||
" tcp no delay " + peer.getTcpNoDelay());
|
||||
LOG.debug("opWriteBlock: stage={}, clientname={}\n " +
|
||||
"block ={}, newGs={}, bytesRcvd=[{}, {}]\n " +
|
||||
"targets={}; pipelineSize={}, srcDataNode={}, pinning={}",
|
||||
stage, clientname, block, latestGenerationStamp, minBytesRcvd,
|
||||
maxBytesRcvd, Arrays.asList(targets), pipelineSize, srcDataNode,
|
||||
pinning);
|
||||
LOG.debug("isDatanode={}, isClient={}, isTransfer={}",
|
||||
isDatanode, isClient, isTransfer);
|
||||
LOG.debug("writeBlock receive buf size {} tcp no delay {}",
|
||||
peer.getReceiveBufferSize(), peer.getTcpNoDelay());
|
||||
}
|
||||
|
||||
// We later mutate block's generation stamp and length, but we need to
|
||||
|
@ -741,8 +734,8 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
if (block.getNumBytes() == 0) {
|
||||
block.setNumBytes(dataXceiverServer.estimateBlockSize);
|
||||
}
|
||||
LOG.info("Receiving " + block + " src: " + remoteAddress + " dest: "
|
||||
+ localAddress);
|
||||
LOG.info("Receiving {} src: {} dest: {}",
|
||||
block, remoteAddress, localAddress);
|
||||
|
||||
DataOutputStream mirrorOut = null; // stream to next target
|
||||
DataInputStream mirrorIn = null; // reply from next target
|
||||
|
@ -778,9 +771,7 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
InetSocketAddress mirrorTarget = null;
|
||||
// Connect to backup machine
|
||||
mirrorNode = targets[0].getXferAddr(connectToDnViaHostname);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Connecting to datanode " + mirrorNode);
|
||||
}
|
||||
LOG.debug("Connecting to datanode {}", mirrorNode);
|
||||
mirrorTarget = NetUtils.createSocketAddr(mirrorNode);
|
||||
mirrorSock = datanode.newSocket();
|
||||
try {
|
||||
|
@ -844,11 +835,10 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
BlockOpResponseProto.parseFrom(PBHelperClient.vintPrefixed(mirrorIn));
|
||||
mirrorInStatus = connectAck.getStatus();
|
||||
firstBadLink = connectAck.getFirstBadLink();
|
||||
if (LOG.isDebugEnabled() || mirrorInStatus != SUCCESS) {
|
||||
LOG.debug("Datanode " + targets.length +
|
||||
" got response for connect ack " +
|
||||
" from downstream datanode with firstbadlink as " +
|
||||
firstBadLink);
|
||||
if (mirrorInStatus != SUCCESS) {
|
||||
LOG.debug("Datanode {} got response for connect" +
|
||||
"ack from downstream datanode with firstbadlink as {}",
|
||||
targets.length, firstBadLink);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -869,13 +859,12 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
IOUtils.closeSocket(mirrorSock);
|
||||
mirrorSock = null;
|
||||
if (isClient) {
|
||||
LOG.error(datanode + ":Exception transfering block " +
|
||||
block + " to mirror " + mirrorNode + ": " + e);
|
||||
LOG.error("{}:Exception transfering block {} to mirror {}",
|
||||
datanode, block, mirrorNode, e);
|
||||
throw e;
|
||||
} else {
|
||||
LOG.info(datanode + ":Exception transfering " +
|
||||
block + " to mirror " + mirrorNode +
|
||||
"- continuing without the mirror", e);
|
||||
LOG.info("{}:Exception transfering {} to mirror {}- continuing " +
|
||||
"without the mirror", datanode, block, mirrorNode, e);
|
||||
incrDatanodeNetworkErrors();
|
||||
}
|
||||
}
|
||||
|
@ -883,10 +872,9 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
|
||||
// send connect-ack to source for clients and not transfer-RBW/Finalized
|
||||
if (isClient && !isTransfer) {
|
||||
if (LOG.isDebugEnabled() || mirrorInStatus != SUCCESS) {
|
||||
LOG.debug("Datanode " + targets.length +
|
||||
" forwarding connect ack to upstream firstbadlink is " +
|
||||
firstBadLink);
|
||||
if (mirrorInStatus != SUCCESS) {
|
||||
LOG.debug("Datanode {} forwarding connect ack to upstream " +
|
||||
"firstbadlink is {}", targets.length, firstBadLink);
|
||||
}
|
||||
BlockOpResponseProto.newBuilder()
|
||||
.setStatus(mirrorInStatus)
|
||||
|
@ -904,9 +892,7 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
|
||||
// send close-ack for transfer-RBW/Finalized
|
||||
if (isTransfer) {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("TRANSFER: send close-ack");
|
||||
}
|
||||
writeResponse(SUCCESS, null, replyOut);
|
||||
}
|
||||
}
|
||||
|
@ -924,15 +910,16 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
if (isDatanode ||
|
||||
stage == BlockConstructionStage.PIPELINE_CLOSE_RECOVERY) {
|
||||
datanode.closeBlock(block, null, storageUuid, isOnTransientStorage);
|
||||
LOG.info("Received " + block + " src: " + remoteAddress + " dest: "
|
||||
+ localAddress + " of size " + block.getNumBytes());
|
||||
LOG.info("Received {} src: {} dest: {} of size {}",
|
||||
block, remoteAddress, localAddress, block.getNumBytes());
|
||||
}
|
||||
|
||||
if(isClient) {
|
||||
size = block.getNumBytes();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
LOG.info("opWriteBlock " + block + " received exception " + ioe);
|
||||
LOG.info("opWriteBlock {} received exception {}",
|
||||
block, ioe.toString());
|
||||
incrDatanodeNetworkErrors();
|
||||
throw ioe;
|
||||
} finally {
|
||||
|
@ -970,7 +957,8 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
targetStorageTypes, targetStorageIds, clientName);
|
||||
writeResponse(Status.SUCCESS, null, out);
|
||||
} catch (IOException ioe) {
|
||||
LOG.info("transferBlock " + blk + " received exception " + ioe);
|
||||
LOG.info("transferBlock {} received exception {}",
|
||||
blk, ioe.toString());
|
||||
incrDatanodeNetworkErrors();
|
||||
throw ioe;
|
||||
} finally {
|
||||
|
@ -1005,7 +993,8 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
.writeDelimitedTo(out);
|
||||
out.flush();
|
||||
} catch (IOException ioe) {
|
||||
LOG.info("blockChecksum " + block + " received exception " + ioe);
|
||||
LOG.info("blockChecksum {} received exception {}",
|
||||
block, ioe.toString());
|
||||
incrDatanodeNetworkErrors();
|
||||
throw ioe;
|
||||
} finally {
|
||||
|
@ -1046,8 +1035,8 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
.writeDelimitedTo(out);
|
||||
out.flush();
|
||||
} catch (IOException ioe) {
|
||||
LOG.info("blockChecksum " + stripedBlockInfo.getBlock() +
|
||||
" received exception " + ioe);
|
||||
LOG.info("blockChecksum {} received exception {}",
|
||||
stripedBlockInfo.getBlock(), ioe.toString());
|
||||
incrDatanodeNetworkErrors();
|
||||
throw ioe;
|
||||
} finally {
|
||||
|
@ -1105,10 +1094,10 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
datanode.metrics.incrBlocksRead();
|
||||
datanode.metrics.incrTotalReadTime(duration);
|
||||
|
||||
LOG.info("Copied " + block + " to " + peer.getRemoteAddressString());
|
||||
LOG.info("Copied {} to {}", block, peer.getRemoteAddressString());
|
||||
} catch (IOException ioe) {
|
||||
isOpSuccess = false;
|
||||
LOG.info("opCopyBlock " + block + " received exception " + ioe);
|
||||
LOG.info("opCopyBlock {} received exception {}", block, ioe.toString());
|
||||
incrDatanodeNetworkErrors();
|
||||
throw ioe;
|
||||
} finally {
|
||||
|
@ -1163,16 +1152,14 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
ReplicaInfo oldReplica = datanode.data.moveBlockAcrossStorage(block,
|
||||
storageType, storageId);
|
||||
if (oldReplica != null) {
|
||||
LOG.info("Moved " + block + " from StorageType "
|
||||
+ oldReplica.getVolume().getStorageType() + " to " + storageType);
|
||||
LOG.info("Moved {} from StorageType {} to {}",
|
||||
block, oldReplica.getVolume().getStorageType(), storageType);
|
||||
}
|
||||
} else {
|
||||
block.setNumBytes(dataXceiverServer.estimateBlockSize);
|
||||
// get the output stream to the proxy
|
||||
final String dnAddr = proxySource.getXferAddr(connectToDnViaHostname);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Connecting to datanode " + dnAddr);
|
||||
}
|
||||
LOG.debug("Connecting to datanode {}", dnAddr);
|
||||
InetSocketAddress proxyAddr = NetUtils.createSocketAddr(dnAddr);
|
||||
proxySock = datanode.newSocket();
|
||||
NetUtils.connect(proxySock, proxyAddr, dnConf.socketTimeout);
|
||||
|
@ -1229,8 +1216,8 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
datanode.notifyNamenodeReceivedBlock(
|
||||
block, delHint, r.getStorageUuid(), r.isOnTransientStorage());
|
||||
|
||||
LOG.info("Moved " + block + " from " + peer.getRemoteAddressString()
|
||||
+ ", delHint=" + delHint);
|
||||
LOG.info("Moved {} from {}, delHint={}",
|
||||
block, peer.getRemoteAddressString(), delHint);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
opStatus = ERROR;
|
||||
|
@ -1260,7 +1247,8 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
try {
|
||||
sendResponse(opStatus, errMsg);
|
||||
} catch (IOException ioe) {
|
||||
LOG.warn("Error writing reply back to " + peer.getRemoteAddressString());
|
||||
LOG.warn("Error writing reply back to {}",
|
||||
peer.getRemoteAddressString());
|
||||
incrDatanodeNetworkErrors();
|
||||
}
|
||||
IOUtils.closeStream(proxyOut);
|
||||
|
@ -1408,10 +1396,8 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
final String[] storageIds) throws IOException {
|
||||
checkAndWaitForBP(blk);
|
||||
if (datanode.isBlockTokenEnabled) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Checking block access token for block '" + blk.getBlockId()
|
||||
+ "' with mode '" + mode + "'");
|
||||
}
|
||||
LOG.debug("Checking block access token for block '{}' with mode '{}'",
|
||||
blk.getBlockId(), mode);
|
||||
try {
|
||||
datanode.blockPoolTokenSecretManager.checkAccess(t, null, blk, mode,
|
||||
storageTypes, storageIds);
|
||||
|
@ -1429,9 +1415,9 @@ class DataXceiver extends Receiver implements Runnable {
|
|||
resp.build().writeDelimitedTo(out);
|
||||
out.flush();
|
||||
}
|
||||
LOG.warn("Block token verification failed: op=" + op
|
||||
+ ", remoteAddress=" + remoteAddress
|
||||
+ ", message=" + e.getLocalizedMessage());
|
||||
LOG.warn("Block token verification failed: op={}, " +
|
||||
"remoteAddress={}, message={}",
|
||||
op, remoteAddress, e.getLocalizedMessage());
|
||||
throw e;
|
||||
} finally {
|
||||
IOUtils.closeStream(out);
|
||||
|
|
|
@ -6185,7 +6185,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|||
LOG.debug("Get corrupt file blocks returned error: " + e.getMessage());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Get corrupt file blocks returned error: " + e.getMessage());
|
||||
LOG.warn("Get corrupt file blocks returned error", e);
|
||||
}
|
||||
return JSON.toString(list);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,6 @@ import java.util.List;
|
|||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.ha.ServiceFailedException;
|
||||
|
@ -51,6 +49,8 @@ import org.apache.hadoop.security.UserGroupInformation;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Thread which runs inside the NN when it's in Standby state,
|
||||
|
@ -60,7 +60,8 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
|||
*/
|
||||
@InterfaceAudience.Private
|
||||
public class StandbyCheckpointer {
|
||||
private static final Log LOG = LogFactory.getLog(StandbyCheckpointer.class);
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(StandbyCheckpointer.class);
|
||||
private static final long PREVENT_AFTER_CANCEL_MS = 2*60*1000L;
|
||||
private final CheckpointConf checkpointConf;
|
||||
private final Configuration conf;
|
||||
|
@ -136,8 +137,8 @@ public class StandbyCheckpointer {
|
|||
|
||||
public void start() {
|
||||
LOG.info("Starting standby checkpoint thread...\n" +
|
||||
"Checkpointing active NN to possible NNs: " + activeNNAddresses + "\n" +
|
||||
"Serving checkpoints at " + myNNAddress);
|
||||
"Checkpointing active NN to possible NNs: {}\n" +
|
||||
"Serving checkpoints at {}", activeNNAddresses, myNNAddress);
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
@ -177,8 +178,8 @@ public class StandbyCheckpointer {
|
|||
assert thisCheckpointTxId >= prevCheckpointTxId;
|
||||
if (thisCheckpointTxId == prevCheckpointTxId) {
|
||||
LOG.info("A checkpoint was triggered but the Standby Node has not " +
|
||||
"received any transactions since the last checkpoint at txid " +
|
||||
thisCheckpointTxId + ". Skipping...");
|
||||
"received any transactions since the last checkpoint at txid {}. " +
|
||||
"Skipping...", thisCheckpointTxId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -253,8 +254,7 @@ public class StandbyCheckpointer {
|
|||
}
|
||||
|
||||
} catch (ExecutionException e) {
|
||||
ioe = new IOException("Exception during image upload: " + e.getMessage(),
|
||||
e.getCause());
|
||||
ioe = new IOException("Exception during image upload", e);
|
||||
break;
|
||||
} catch (InterruptedException e) {
|
||||
ie = e;
|
||||
|
@ -401,15 +401,15 @@ public class StandbyCheckpointer {
|
|||
if (needCheckpoint) {
|
||||
LOG.info("Triggering a rollback fsimage for rolling upgrade.");
|
||||
} else if (uncheckpointed >= checkpointConf.getTxnCount()) {
|
||||
LOG.info("Triggering checkpoint because there have been " +
|
||||
uncheckpointed + " txns since the last checkpoint, which " +
|
||||
"exceeds the configured threshold " +
|
||||
checkpointConf.getTxnCount());
|
||||
LOG.info("Triggering checkpoint because there have been {} txns " +
|
||||
"since the last checkpoint, " +
|
||||
"which exceeds the configured threshold {}",
|
||||
uncheckpointed, checkpointConf.getTxnCount());
|
||||
needCheckpoint = true;
|
||||
} else if (secsSinceLast >= checkpointConf.getPeriod()) {
|
||||
LOG.info("Triggering checkpoint because it has been " +
|
||||
secsSinceLast + " seconds since the last checkpoint, which " +
|
||||
"exceeds the configured interval " + checkpointConf.getPeriod());
|
||||
LOG.info("Triggering checkpoint because it has been {} seconds " +
|
||||
"since the last checkpoint, which exceeds the configured " +
|
||||
"interval {}", secsSinceLast, checkpointConf.getPeriod());
|
||||
needCheckpoint = true;
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ public class StandbyCheckpointer {
|
|||
LOG.info("Checkpoint finished successfully.");
|
||||
}
|
||||
} catch (SaveNamespaceCancelledException ce) {
|
||||
LOG.info("Checkpoint was cancelled: " + ce.getMessage());
|
||||
LOG.info("Checkpoint was cancelled: {}", ce.getMessage());
|
||||
canceledCount++;
|
||||
} catch (InterruptedException ie) {
|
||||
LOG.info("Interrupted during checkpointing", ie);
|
||||
|
|
|
@ -1332,7 +1332,7 @@ public class MiniDFSCluster implements AutoCloseable {
|
|||
try {
|
||||
uri = new URI("hdfs://" + hostPort);
|
||||
} catch (URISyntaxException e) {
|
||||
NameNode.LOG.warn("unexpected URISyntaxException: " + e );
|
||||
NameNode.LOG.warn("unexpected URISyntaxException", e);
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ import org.apache.commons.cli.HelpFormatter;
|
|||
import org.apache.commons.cli.OptionBuilder;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hdfs.HdfsConfiguration;
|
||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption;
|
||||
import org.eclipse.jetty.util.ajax.JSON;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* This class drives the creation of a mini-cluster on the local machine. By
|
||||
|
@ -58,8 +58,8 @@ import org.eclipse.jetty.util.ajax.JSON;
|
|||
* $HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/share/hadoop/hdfs/hadoop-hdfs-0.24.0-SNAPSHOT-tests.jar org.apache.hadoop.test.MiniDFSClusterManager -options...
|
||||
*/
|
||||
public class MiniDFSClusterManager {
|
||||
private static final Log LOG =
|
||||
LogFactory.getLog(MiniDFSClusterManager.class);
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(MiniDFSClusterManager.class);
|
||||
|
||||
private MiniDFSCluster dfs;
|
||||
private String writeDetails;
|
||||
|
@ -146,8 +146,8 @@ public class MiniDFSClusterManager {
|
|||
.build();
|
||||
dfs.waitActive();
|
||||
|
||||
LOG.info("Started MiniDFSCluster -- namenode on port "
|
||||
+ dfs.getNameNodePort());
|
||||
LOG.info("Started MiniDFSCluster -- namenode on port {}",
|
||||
dfs.getNameNodePort());
|
||||
|
||||
if (writeConfig != null) {
|
||||
FileOutputStream fos = new FileOutputStream(new File(writeConfig));
|
||||
|
@ -180,7 +180,7 @@ public class MiniDFSClusterManager {
|
|||
CommandLineParser parser = new GnuParser();
|
||||
cli = parser.parse(options, args);
|
||||
} catch(ParseException e) {
|
||||
LOG.warn("options parsing failed: "+e.getMessage());
|
||||
LOG.warn("options parsing failed", e);
|
||||
new HelpFormatter().printHelp("...", options);
|
||||
return false;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ public class MiniDFSClusterManager {
|
|||
|
||||
if (cli.getArgs().length > 0) {
|
||||
for (String arg : cli.getArgs()) {
|
||||
LOG.error("Unrecognized option: " + arg);
|
||||
LOG.error("Unrecognized option: {}", arg);
|
||||
new HelpFormatter().printHelp("...", options);
|
||||
return false;
|
||||
}
|
||||
|
@ -236,12 +236,12 @@ public class MiniDFSClusterManager {
|
|||
conf2.set(keyval[0], keyval[1]);
|
||||
num_confs_updated++;
|
||||
} else {
|
||||
LOG.warn("Ignoring -D option " + prop);
|
||||
LOG.warn("Ignoring -D option {}", prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG.info("Updated " + num_confs_updated +
|
||||
" configuration settings from command line.");
|
||||
LOG.info("Updated {} configuration settings from command line.",
|
||||
num_confs_updated);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,8 +254,8 @@ public class MiniDFSClusterManager {
|
|||
return Integer.parseInt(o);
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
LOG.error("Couldn't parse value (" + o + ") for option "
|
||||
+ argName + ". Using default: " + defaultValue);
|
||||
LOG.error("Couldn't parse value ({}) for option {}. " +
|
||||
"Using default: {}", o, argName, defaultValue);
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
|
|
|
@ -45,8 +45,8 @@ import org.apache.hadoop.util.Tool;
|
|||
import org.apache.hadoop.util.ToolRunner;
|
||||
import org.apache.hadoop.tools.rumen.JobStoryProducer;
|
||||
import org.apache.hadoop.tools.rumen.ZombieJobProducer;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Driver class for the Gridmix3 benchmark. Gridmix accepts a timestamped
|
||||
|
@ -58,7 +58,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
*/
|
||||
public class Gridmix extends Configured implements Tool {
|
||||
|
||||
public static final Log LOG = LogFactory.getLog(Gridmix.class);
|
||||
public static final Logger LOG = LoggerFactory.getLogger(Gridmix.class);
|
||||
|
||||
/**
|
||||
* Output (scratch) directory for submitted jobs. Relative paths are
|
||||
|
@ -184,8 +184,8 @@ public class Gridmix extends Configured implements Tool {
|
|||
final Configuration conf = getConf();
|
||||
|
||||
if (inputDir.getFileSystem(conf).exists(inputDir)) {
|
||||
LOG.error("Gridmix input data directory " + inputDir
|
||||
+ " already exists when -generate option is used.\n");
|
||||
LOG.error("Gridmix input data directory {} already exists " +
|
||||
"when -generate option is used.", inputDir);
|
||||
return STARTUP_FAILED_ERROR;
|
||||
}
|
||||
|
||||
|
@ -193,13 +193,13 @@ public class Gridmix extends Configured implements Tool {
|
|||
CompressionEmulationUtil.setupDataGeneratorConfig(conf);
|
||||
|
||||
final GenerateData genData = new GenerateData(conf, inputDir, genbytes);
|
||||
LOG.info("Generating " + StringUtils.humanReadableInt(genbytes) +
|
||||
" of test data...");
|
||||
LOG.info("Generating {} of test data...",
|
||||
StringUtils.TraditionalBinaryPrefix.long2String(genbytes, "", 1));
|
||||
launchGridmixJob(genData);
|
||||
|
||||
FsShell shell = new FsShell(conf);
|
||||
try {
|
||||
LOG.info("Changing the permissions for inputPath " + inputDir.toString());
|
||||
LOG.info("Changing the permissions for inputPath {}", inputDir);
|
||||
shell.run(new String[] {"-chmod","-R","777", inputDir.toString()});
|
||||
} catch (Exception e) {
|
||||
LOG.error("Couldnt change the file permissions " , e);
|
||||
|
@ -528,9 +528,7 @@ public class Gridmix extends Configured implements Tool {
|
|||
statistics.start();
|
||||
} catch (Throwable e) {
|
||||
LOG.error("Startup failed. " + e.toString() + "\n");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LOG.debug("Startup failed", e);
|
||||
if (factory != null) factory.abort(); // abort pipeline
|
||||
exitCode = STARTUP_FAILED_ERROR;
|
||||
} finally {
|
||||
|
@ -561,7 +559,7 @@ public class Gridmix extends Configured implements Tool {
|
|||
summarizer.finalize(factory, traceIn, genbytes, userResolver, stats,
|
||||
conf);
|
||||
}
|
||||
IOUtils.cleanup(LOG, trace);
|
||||
IOUtils.cleanupWithLogger(LOG, trace);
|
||||
}
|
||||
return exitCode;
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
|
||||
package org.apache.hadoop.fs.swift.http;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.fs.swift.exceptions.SwiftConnectionClosedException;
|
||||
import org.apache.hadoop.fs.swift.util.SwiftUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.EOFException;
|
||||
|
@ -44,8 +44,8 @@ import java.net.URI;
|
|||
*/
|
||||
public class HttpInputStreamWithRelease extends InputStream {
|
||||
|
||||
private static final Log LOG =
|
||||
LogFactory.getLog(HttpInputStreamWithRelease.class);
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(HttpInputStreamWithRelease.class);
|
||||
private final URI uri;
|
||||
private HttpRequestBase req;
|
||||
private HttpResponse resp;
|
||||
|
@ -100,9 +100,7 @@ public class HttpInputStreamWithRelease extends InputStream {
|
|||
if (!released) {
|
||||
reasonClosed = reason;
|
||||
try {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Releasing connection to " + uri + ": " + reason, ex);
|
||||
}
|
||||
LOG.debug("Releasing connection to {}: {}", uri, reason, ex);
|
||||
if (req != null) {
|
||||
if (!dataConsumed) {
|
||||
req.abort();
|
||||
|
@ -137,7 +135,7 @@ public class HttpInputStreamWithRelease extends InputStream {
|
|||
try {
|
||||
release(operation, ex);
|
||||
} catch (IOException ioe) {
|
||||
LOG.debug("Exception during release: " + operation + " - " + ioe, ioe);
|
||||
LOG.debug("Exception during release: {}", operation, ioe);
|
||||
//make this the exception if there was none before
|
||||
if (ex == null) {
|
||||
ex = ioe;
|
||||
|
@ -173,9 +171,7 @@ public class HttpInputStreamWithRelease extends InputStream {
|
|||
try {
|
||||
read = inStream.read();
|
||||
} catch (EOFException e) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("EOF exception " + e, e);
|
||||
}
|
||||
LOG.debug("EOF exception", e);
|
||||
read = -1;
|
||||
} catch (IOException e) {
|
||||
throw releaseAndRethrow("read()", e);
|
||||
|
@ -200,9 +196,7 @@ public class HttpInputStreamWithRelease extends InputStream {
|
|||
try {
|
||||
read = inStream.read(b, off, len);
|
||||
} catch (EOFException e) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("EOF exception " + e, e);
|
||||
}
|
||||
LOG.debug("EOF exception", e);
|
||||
read = -1;
|
||||
} catch (IOException e) {
|
||||
throw releaseAndRethrow("read(b, off, " + len + ")", e);
|
||||
|
@ -222,13 +216,12 @@ public class HttpInputStreamWithRelease extends InputStream {
|
|||
protected void finalize() {
|
||||
try {
|
||||
if (release("finalize()", constructionStack)) {
|
||||
LOG.warn("input stream of " + uri
|
||||
+ " not closed properly -cleaned up in finalize()");
|
||||
LOG.warn("input stream of {}" +
|
||||
" not closed properly -cleaned up in finalize()", uri);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//swallow anything that failed here
|
||||
LOG.warn("Exception while releasing " + uri + "in finalizer",
|
||||
e);
|
||||
LOG.warn("Exception while releasing {} in finalizer", uri, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue