HDFS-6433. Merging change r1596742 from trunk to branch-2.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1596745 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c362382259
commit
378153dd71
|
@ -260,6 +260,9 @@ Release 2.5.0 - UNRELEASED
|
||||||
HDFS-6409. Fix typo in log message about NameNode layout version upgrade.
|
HDFS-6409. Fix typo in log message about NameNode layout version upgrade.
|
||||||
(Chen He via cnauroth)
|
(Chen He via cnauroth)
|
||||||
|
|
||||||
|
HDFS-6433. Replace BytesMoved class with AtomicLong.
|
||||||
|
(Benoy Antony via cnauroth)
|
||||||
|
|
||||||
Release 2.4.1 - UNRELEASED
|
Release 2.4.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -47,6 +47,7 @@ import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -365,7 +366,7 @@ public class Balancer {
|
||||||
|
|
||||||
sendRequest(out);
|
sendRequest(out);
|
||||||
receiveResponse(in);
|
receiveResponse(in);
|
||||||
bytesMoved.inc(block.getNumBytes());
|
bytesMoved.addAndGet(block.getNumBytes());
|
||||||
LOG.info("Successfully moved " + this);
|
LOG.info("Successfully moved " + this);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.warn("Failed to move " + this + ": " + e.getMessage());
|
LOG.warn("Failed to move " + this + ": " + e.getMessage());
|
||||||
|
@ -1111,17 +1112,7 @@ public class Balancer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BytesMoved {
|
private final AtomicLong bytesMoved = new AtomicLong();
|
||||||
private long bytesMoved = 0L;;
|
|
||||||
private synchronized void inc( long bytes ) {
|
|
||||||
bytesMoved += bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized long get() {
|
|
||||||
return bytesMoved;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private final BytesMoved bytesMoved = new BytesMoved();
|
|
||||||
|
|
||||||
/* Start a thread to dispatch block moves for each source.
|
/* Start a thread to dispatch block moves for each source.
|
||||||
* The thread selects blocks to move & sends request to proxy source to
|
* The thread selects blocks to move & sends request to proxy source to
|
||||||
|
|
Loading…
Reference in New Issue