You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2015/05/09 06:44:24 UTC
hbase git commit: HBASE-13649 CellComparator.compareTimestamps
javadoc inconsistent and wrong (Dave Latham)
Repository: hbase
Updated Branches:
refs/heads/branch-1 37ac28ea5 -> fdaeb8601
HBASE-13649 CellComparator.compareTimestamps javadoc inconsistent and wrong (Dave Latham)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/fdaeb860
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/fdaeb860
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/fdaeb860
Branch: refs/heads/branch-1
Commit: fdaeb8601979eaf9b69b4c91c5e509f40c573eb1
Parents: 37ac28e
Author: stack <st...@apache.org>
Authored: Fri May 8 21:44:07 2015 -0700
Committer: stack <st...@apache.org>
Committed: Fri May 8 21:44:07 2015 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hbase/CellComparator.java | 26 ++++++++++++++++----
1 file changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/fdaeb860/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
index 2c1cc09..ca4cfb1 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
@@ -234,6 +234,16 @@ public class CellComparator implements Comparator<Cell>, Serializable {
return (0xff & rightCell.getTypeByte()) - (0xff & leftCell.getTypeByte());
}
+ /**
+ * Compares cell's timestamps in DESCENDING order.
+ * The below older timestamps sorting ahead of newer timestamps looks
+ * wrong but it is intentional. This way, newer timestamps are first
+ * found when we iterate over a memstore and newer versions are the
+ * first we trip over when reading from a store file.
+ * @return 1 if left's timestamp < right's timestamp
+ * -1 if left's timestamp > right's timestamp
+ * 0 if both timestamps are equal
+ */
public static int compareTimestamps(final Cell left, final Cell right) {
long ltimestamp = left.getTimestamp();
long rtimestamp = right.getTimestamp();
@@ -258,7 +268,7 @@ public class CellComparator implements Comparator<Cell>, Serializable {
/**
* Returns a hash code that is always the same for two Cells having a matching
* equals(..) result. Note : Ignore mvcc while calculating the hashcode
- *
+ *
* @param cell
* @return hashCode
*/
@@ -356,11 +366,17 @@ public class CellComparator implements Comparator<Cell>, Serializable {
return c;
}
+ /**
+ * Compares timestamps in DESCENDING order.
+ * The below older timestamps sorting ahead of newer timestamps looks
+ * wrong but it is intentional. This way, newer timestamps are first
+ * found when we iterate over a memstore and newer versions are the
+ * first we trip over when reading from a store file.
+ * @return 1 if left timestamp < right timestamp
+ * -1 if left timestamp > right timestamp
+ * 0 if both timestamps are equal
+ */
private static int compareTimestamps(final long ltimestamp, final long rtimestamp) {
- // The below older timestamps sorting ahead of newer timestamps looks
- // wrong but it is intentional. This way, newer timestamps are first
- // found when we iterate over a memstore and newer versions are the
- // first we trip over when reading from a store file.
if (ltimestamp < rtimestamp) {
return 1;
} else if (ltimestamp > rtimestamp) {