HDFS-4106. Merging change r1403075 from trunk.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1409039 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2012-11-14 00:03:15 +00:00
parent 6a743f3f5b
commit 09774b8005
2 changed files with 10 additions and 3 deletions

View File

@ -229,6 +229,9 @@ Release 2.0.3-alpha - Unreleased
HDFS-3921. NN will prematurely consider blocks missing when entering active HDFS-3921. NN will prematurely consider blocks missing when entering active
state while still in safe mode. (atm) state while still in safe mode. (atm)
HDFS-4106. BPServiceActor#lastHeartbeat, lastBlockReport and
lastDeletedReport should be volatile. (Jing Zhao via suresh)
Release 2.0.2-alpha - 2012-09-07 Release 2.0.2-alpha - 2012-09-07
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -75,14 +75,18 @@ class BPServiceActor implements Runnable {
BPOfferService bpos; BPOfferService bpos;
long lastBlockReport = 0; // lastBlockReport, lastDeletedReport and lastHeartbeat may be assigned/read
long lastDeletedReport = 0; // by testing threads (through BPServiceActor#triggerXXX), while also
// assigned/read by the actor thread. Thus they should be declared as volatile
// to make sure the "happens-before" consistency.
volatile long lastBlockReport = 0;
volatile long lastDeletedReport = 0;
boolean resetBlockReportTime = true; boolean resetBlockReportTime = true;
Thread bpThread; Thread bpThread;
DatanodeProtocolClientSideTranslatorPB bpNamenode; DatanodeProtocolClientSideTranslatorPB bpNamenode;
private long lastHeartbeat = 0; private volatile long lastHeartbeat = 0;
private volatile boolean initialized = false; private volatile boolean initialized = false;
/** /**