HBASE-18824 Add meaningful comment to HConstants.LATEST_TIMESTAMP to explain why it is MAX_VALUE
Signed-off-by: Chia-Ping Tsai <chia7...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/2ee8690b Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/2ee8690b Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/2ee8690b Branch: refs/heads/HBASE-18410 Commit: 2ee8690b47763fd0ed97d47713b1c516633f597b Parents: 38879fb Author: Xiang Li <wate...@gmail.com> Authored: Tue Sep 19 23:10:31 2017 +0800 Committer: Chia-Ping Tsai <chia7...@gmail.com> Committed: Sun Oct 22 04:47:00 2017 +0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/HConstants.java | 21 ++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/2ee8690b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java ---------------------------------------------------------------------- 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 7577644..a272fc8 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;