Skip to content

Commit 272e27d

Browse files
author
lgh
committed
fix mis-order of ibr and fbr.
1 parent 2b1378c commit 272e27d

File tree

1 file changed

+9
-8
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode

1 file changed

+9
-8
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class BPServiceActor implements Runnable {
103103

104104
volatile long lastCacheReport = 0;
105105
private final Scheduler scheduler;
106-
private final Object sendIBRLock;
106+
private final Object sendBRLock;
107107
private final ExecutorService ibrExecutorService;
108108

109109
Thread bpThread;
@@ -161,7 +161,7 @@ enum RunningState {
161161
}
162162
commandProcessingThread = new CommandProcessingThread(this);
163163
commandProcessingThread.start();
164-
sendIBRLock = new Object();
164+
sendBRLock = new Object();
165165
ibrExecutorService = Executors.newSingleThreadExecutor(
166166
new ThreadFactoryBuilder().setDaemon(true)
167167
.setNameFormat("ibr-executor-%d").build());
@@ -397,10 +397,9 @@ List<DatanodeCommand> blockReport(long fullBrLeaseId) throws IOException {
397397
// we have a chance that we will miss the delHint information
398398
// or we will report an RBW replica after the BlockReport already reports
399399
// a FINALIZED one.
400-
synchronized (sendIBRLock) {
401-
ibrManager.sendIBRs(bpNamenode, bpRegistration,
402-
bpos.getBlockPoolId(), getRpcMetricSuffix());
403-
}
400+
ibrManager.sendIBRs(bpNamenode, bpRegistration,
401+
bpos.getBlockPoolId(), getRpcMetricSuffix());
402+
404403

405404
long brCreateStartTime = monotonicNow();
406405
Map<DatanodeStorage, BlockListAsLongs> perVolumeBlockLists =
@@ -765,7 +764,9 @@ private void offerService() throws Exception {
765764
LOG.info("Forcing a full block report to " + nnAddr);
766765
}
767766
if ((fullBlockReportLeaseId != 0) || forceFullBr) {
768-
cmds = blockReport(fullBlockReportLeaseId);
767+
synchronized (sendBRLock) {
768+
cmds = blockReport(fullBlockReportLeaseId);
769+
}
769770
fullBlockReportLeaseId = 0;
770771
}
771772
commandProcessingThread.enqueue(cmds);
@@ -1170,7 +1171,7 @@ public void run() {
11701171
final boolean sendHeartbeat = scheduler.isHeartbeatDue(startTime);
11711172
if (!dn.areIBRDisabledForTests() &&
11721173
(ibrManager.sendImmediately() || sendHeartbeat)) {
1173-
synchronized (sendIBRLock) {
1174+
synchronized (sendBRLock) {
11741175
ibrManager.sendIBRs(bpNamenode, bpRegistration,
11751176
bpos.getBlockPoolId(), getRpcMetricSuffix());
11761177
}

0 commit comments

Comments
 (0)