From 2c50b2d7296ae1332b491c4c9b34d1460d2757c1 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 19 Sep 2017 23:10:31 +0800 Subject: [PATCH] HBASE-18824 Add meaningful comment to HConstants.LATEST_TIMESTAMP to explain why it is MAX_VALUE --- .../java/org/apache/hadoop/hbase/HConstants.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java index 7577644d32..5eb2ae2130 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java @@ -549,8 +549,24 @@ public final class HConstants { /** * Timestamp to use when we want to refer to the latest cell. - * This is the timestamp sent by clients when no timestamp is specified on - * commit. + * + * On client side, this is the timestamp set by default when no timestamp is specified, to refer to the latest. + * On server side, this acts as a notation. + * (1) For a cell of Put, which has this notation, + * its timestamp will be replaced with server's current time. + * (2) For a cell of Delete, which has this notation, + * A. If the cell is of {@link KeyValue.Type#Delete}, + * a. When the count of existing cells is less than the count to delete, + * the Delete cell's timestamp will be replaced with server's current time. + * b. When the count of existing cells is equal to the count to delete, + * the Delete cell's timestamp will be replaced with the latest timestamp of existing cells. + * c. When the count of existing cells is greater than the count to delete, + * it is an invalid condition, as the max version to get is set to the count to delete. + * B. If the cell is of other Delete types, like {@link KeyValue.Type#DeleteFamilyVersion}, + * {@link KeyValue.Type#DeleteColumn}, or {@link KeyValue.Type#DeleteFamily}, + * the Delete cell's timestamp will be replaced with server's current time. + * + * So that is why it is named as "latest" but assigned as Long's max value. */ public static final long LATEST_TIMESTAMP = Long.MAX_VALUE; -- 2.14.1