HBASE-1792 [Regression] Cannot save timestamp in the future

HBASE-1793  [Regression] HTable.get/getRow with a ts is broken


git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@807855 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2009-08-26 00:03:42 +00:00
parent fcc84c258f
commit de546af646
3 changed files with 15 additions and 11 deletions

View File

@ -6,6 +6,8 @@ Release 0.21.0 - Unreleased
HBASE-1791 Timeout in IndexRecordWriter (Bradford Stephens via Andrew
Purtell)
HBASE-1737 Regions unbalanced when adding new node (recommit)
HBASE-1792 [Regression] Cannot save timestamp in the future
HBASE-1793 [Regression] HTable.get/getRow with a ts is broken
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -796,9 +796,8 @@ public class HTable implements HTableInterface {
g.addColumn(fq[0], fq[1]);
}
g.setMaxVersions(numVersions);
if (timestamp != HConstants.LATEST_TIMESTAMP) {
g.setTimeStamp(timestamp);
}
g.setTimeRange(0,
timestamp == HConstants.LATEST_TIMESTAMP ? timestamp : timestamp+1);
Result r = get(g);
return r == null || r.size() <= 0? null: r.getCellValues();
}
@ -1054,9 +1053,8 @@ public class HTable implements HTableInterface {
}
}
g.setMaxVersions(numVersions);
if (ts != HConstants.LATEST_TIMESTAMP) {
g.setTimeStamp(ts);
}
g.setTimeRange(0,
ts == HConstants.LATEST_TIMESTAMP ? ts : ts+1);
Result r = get(g);
return r == null || r.size() <= 0? null: r.getRowResult();
}
@ -1310,6 +1308,8 @@ public class HTable implements HTableInterface {
scan.addColumn(splits[0], splits[1]);
}
}
scan.setTimeRange(0,
timestamp == HConstants.LATEST_TIMESTAMP ? timestamp : timestamp+1);
OldClientScanner s = new OldClientScanner(new ClientScanner(scan));
s.initialize();
return s;
@ -1706,7 +1706,8 @@ public class HTable implements HTableInterface {
final long timestamp, final RowLock rl) throws IOException {
final Get g = new Get(row, rl);
g.addColumn(column);
g.setTimeStamp(timestamp);
g.setTimeRange(0,
timestamp == HConstants.LATEST_TIMESTAMP ? timestamp : timestamp+1);
return exists(g);
}

View File

@ -1331,10 +1331,9 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
/**
* Checks if any stamps are > now. If so, sets them to now.
* Checks if any stamps is Long.MAX_VALUE. If so, sets them to now.
* <p>
* This acts to be prevent users from inserting future stamps as well as
* to replace LATEST_TIMESTAMP with now.
* This acts to replace LATEST_TIMESTAMP with now.
* @param keys
* @param now
* @return <code>true</code> when updating the time stamp completed.
@ -1344,7 +1343,9 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
return false;
}
for(KeyValue key : keys) {
key.updateLatestStamp(now);
if(key.getTimestamp() == HConstants.LATEST_TIMESTAMP) {
key.updateLatestStamp(now);
}
}
return true;
}