diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java index 910ac4ac6e0..044911d7a32 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.ReentrantLock; import org.apache.commons.logging.Log; @@ -856,7 +857,7 @@ public class SplitLogManager extends ZooKeeperListener { " while the timeout is " + timeout); return false; } - if (task.unforcedResubmits >= resubmit_threshold) { + if (task.unforcedResubmits.get() >= resubmit_threshold) { if (!task.resubmitThresholdReached) { task.resubmitThresholdReached = true; SplitLogCounters.tot_mgr_resubmit_threshold_reached.incrementAndGet(); @@ -904,7 +905,7 @@ public class SplitLogManager extends ZooKeeperListener { } // don't count forced resubmits if (directive != FORCE) { - task.unforcedResubmits++; + task.unforcedResubmits.incrementAndGet(); } task.setUnassigned(); createRescanNode(Long.MAX_VALUE); @@ -1281,7 +1282,7 @@ public class SplitLogManager extends ZooKeeperListener { volatile TaskBatch batch; volatile TerminationStatus status; volatile int incarnation; - volatile int unforcedResubmits; + volatile AtomicInteger unforcedResubmits = new AtomicInteger(); volatile boolean resubmitThresholdReached; @Override @@ -1291,7 +1292,7 @@ public class SplitLogManager extends ZooKeeperListener { " cur_worker_name = " + cur_worker_name + " status = " + status + " incarnation = " + incarnation + - " resubmits = " + unforcedResubmits + + " resubmits = " + unforcedResubmits.get() + " batch = " + batch); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java index 0b6fd616c1f..742f9443f99 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java @@ -255,7 +255,7 @@ public class TestSplitLogManager { LOG.debug("task = " + task); assertEquals(1L, tot_mgr_resubmit.get()); assertEquals(1, task.incarnation); - assertEquals(0, task.unforcedResubmits); + assertEquals(0, task.unforcedResubmits.get()); assertTrue(task.isOrphan()); assertTrue(task.isUnassigned()); assertTrue(ZKUtil.checkExists(zkw, tasknode) > version);