From c6236a57a559106ecc35cc00ee1fa3e084204695 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 26 Feb 2014 23:12:02 +0000 Subject: [PATCH] HBASE-10598 Written data can not be read out because MemStore#timeRangeTracker might be updated concurrently (cuijianwei) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1572333 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/regionserver/TimeRangeTracker.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java index 25cc436e634..a302d64c34b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java @@ -96,7 +96,7 @@ public class TimeRangeTracker implements Writable { * If required, update the current TimestampRange to include timestamp * @param timestamp the timestamp value to include */ - private void includeTimestamp(final long timestamp) { + private synchronized void includeTimestamp(final long timestamp) { if (maximumTimestamp == -1) { minimumTimestamp = timestamp; maximumTimestamp = timestamp; @@ -115,7 +115,7 @@ public class TimeRangeTracker implements Writable { * @param tr TimeRange * @return True if there is overlap, false otherwise */ - public boolean includesTimeRange(final TimeRange tr) { + public synchronized boolean includesTimeRange(final TimeRange tr) { return (this.minimumTimestamp < tr.getMax() && this.maximumTimestamp >= tr.getMin()); } @@ -123,14 +123,14 @@ public class TimeRangeTracker implements Writable { /** * @return the minimumTimestamp */ - public long getMinimumTimestamp() { + public synchronized long getMinimumTimestamp() { return minimumTimestamp; } /** * @return the maximumTimestamp */ - public long getMaximumTimestamp() { + public synchronized long getMaximumTimestamp() { return maximumTimestamp; }