From 2ee8690b47763fd0ed97d47713b1c516633f597b 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 Signed-off-by: Chia-Ping Tsai --- .../org/apache/hadoop/hbase/HConstants.java | 21 +++++++++++++++++-- 1 file changed, 19 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 7577644d322..a272fc8ab5c 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,25 @@ 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}, HBase issues a Get operation firstly. + * a. When the count of cell it gets is less than the count of cell to delete, + * the timestamp of Delete cell will be replaced with server's current time. + * b. When the count of cell it gets is equal to the count of cell to delete, + * the timestamp of Delete cell will be replaced with the latest timestamp of cell it gets. + * (c. It is invalid and an exception will be thrown, + * if the count of cell it gets is greater than the count of cell to delete, + * as the max version of Get is set to the count of cell 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 timestamp of Delete cell will be replaced with server's current time. + * + * So that is why it is named as "latest" but assigned as the max value of Long. */ public static final long LATEST_TIMESTAMP = Long.MAX_VALUE;