@@ -123,6 +123,7 @@ enum RunningState {
123123 private final DNConf dnConf ;
124124 private long prevBlockReportId ;
125125 private volatile long fullBlockReportLeaseId ;
126+ private volatile boolean shouldSendFBR = true ;
126127 private final SortedSet <Integer > blockReportSizes =
127128 Collections .synchronizedSortedSet (new TreeSet <>());
128129 private final int maxDataLength ;
@@ -149,6 +150,7 @@ enum RunningState {
149150 dn .getMetrics ());
150151 prevBlockReportId = ThreadLocalRandom .current ().nextLong ();
151152 fullBlockReportLeaseId = 0 ;
153+ shouldSendFBR = true ;
152154 scheduler = new Scheduler (dnConf .heartBeatInterval ,
153155 dnConf .getLifelineIntervalMs (), dnConf .blockReportInterval ,
154156 dnConf .outliersReportIntervalMs , dnConf .heartBeatReRegisterInterval );
@@ -771,7 +773,8 @@ private void offerService() throws Exception {
771773 if (forceFullBr ) {
772774 LOG .info ("Forcing a full block report to " + nnAddr );
773775 }
774- if ((fullBlockReportLeaseId != 0 ) || forceFullBr ) {
776+ if ((fullBlockReportLeaseId != 0 && shouldSendFBR ) || forceFullBr ) {
777+ shouldSendFBR = false ;
775778 fbrExecutorService .submit (new FBRTaskHandler ());
776779 }
777780
@@ -799,6 +802,7 @@ private void offerService() throws Exception {
799802 }
800803 if (InvalidBlockReportLeaseException .class .getName ().equals (reClass )) {
801804 fullBlockReportLeaseId = 0 ;
805+ shouldSendFBR = true ;
802806 }
803807 LOG .warn ("RemoteException in offerService" , re );
804808 sleepAfterException ();
@@ -873,6 +877,7 @@ void register(NamespaceInfo nsInfo) throws IOException {
873877 // reset lease id whenever registered to NN.
874878 // ask for a new lease id at the next heartbeat.
875879 fullBlockReportLeaseId = 0 ;
880+ shouldSendFBR = true ;
876881
877882 // random short delay - helps scatter the BR from all DNs
878883 scheduler .scheduleBlockReport (dnConf .initialBlockReportDelayMs , true );
@@ -1212,8 +1217,10 @@ public void run() {
12121217 }
12131218 fullBlockReportLeaseId = 0 ;
12141219 commandProcessingThread .enqueue (cmds );
1220+ shouldSendFBR = true ;
12151221 } catch (Throwable t ) {
12161222 fullBlockReportLeaseId = 0 ;
1223+ shouldSendFBR = true ;
12171224 LOG .warn ("InterruptedException in FBR Task Handler." , t );
12181225 sleepAndLogInterrupts (5000 , "offering FBR service" );
12191226 synchronized (ibrManager ) {
0 commit comments