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
This commit is contained in:
Michael Stack 2014-02-26 23:12:02 +00:00
parent e09d637d7a
commit c6236a57a5

View File

@ -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;
}