HDFS-2626. BPOfferService.verifyAndSetNamespaceInfo needs to be synchronized. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1210340 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2011-12-05 06:36:00 +00:00
parent 74b1f069cc
commit b3f28dbb3d
3 changed files with 4 additions and 4 deletions

View File

@ -39,3 +39,5 @@ HDFS-2622. Fix TestDFSUpgrade in HA branch. (todd)
HDFS-2612. Handle refreshNameNodes in federated HA clusters (todd) HDFS-2612. Handle refreshNameNodes in federated HA clusters (todd)
HDFS-2623. Add test case for hot standby capability (todd) HDFS-2623. Add test case for hot standby capability (todd)
HDFS-2626. BPOfferService.verifyAndSetNamespaceInfo needs to be synchronized (todd)

View File

@ -262,7 +262,7 @@ DataNode getDataNode() {
* verifies that this namespace matches (eg to prevent a misconfiguration * verifies that this namespace matches (eg to prevent a misconfiguration
* where a StandbyNode from a different cluster is specified) * where a StandbyNode from a different cluster is specified)
*/ */
void verifyAndSetNamespaceInfo(NamespaceInfo nsInfo) throws IOException { synchronized void verifyAndSetNamespaceInfo(NamespaceInfo nsInfo) throws IOException {
if (this.bpNSInfo == null) { if (this.bpNSInfo == null) {
this.bpNSInfo = nsInfo; this.bpNSInfo = nsInfo;

View File

@ -336,8 +336,6 @@ DatanodeCommand blockReport() throws IOException {
HeartbeatResponse sendHeartBeat() throws IOException { HeartbeatResponse sendHeartBeat() throws IOException {
LOG.info("heartbeat: " + this); LOG.info("heartbeat: " + this);
// TODO: saw an NPE here - maybe if the two BPOS register at
// same time, this one won't block on the other one?
return bpNamenode.sendHeartbeat(bpRegistration, return bpNamenode.sendHeartbeat(bpRegistration,
dn.getFSDataset().getCapacity(), dn.getFSDataset().getCapacity(),
dn.getFSDataset().getDfsUsed(), dn.getFSDataset().getDfsUsed(),
@ -632,4 +630,4 @@ void reRegister() throws IOException {
} }
} }
} }