hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Hsieh (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-6990) Pretty print TTL
Date Tue, 13 May 2014 15:59:18 GMT

    [ https://issues.apache.org/jira/browse/HBASE-6990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13996526#comment-13996526
] 

Jonathan Hsieh commented on HBASE-6990:
---------------------------------------

Let's make this super readable and so we can use this for other units eventually as well.
 A bunch of terms are added and we can probably get away with fewer.

"Human" is a poor class name  (the code in it doesn't represent a human).  Maybe PrettyPrinter?

Unit is good to have in pretty printer.  

Keep the HColumnDescriptor stuff in HCD, and keep the PrettyPrinter stuff in its class. So
move getUnit, the method that figure out units, into HColumnDescriptor (e.g. "TTL" is a TIME_INTERVAL
unit) .  Have the "Human.toHumanString" call take the value and the unit and not the HCD specific
string.  It would look like "Human.toHumanString(String value, Unit unit)".

nit: Rename "toHumanString" to something else like format.  So the call HCD might become "PrettyPrinter.format(value,
unit)".  Seems clearer than "Human.toHumanString".

Duplicate? its in the "Human" class also.
{code}
   /**
+   *  TTL related constat for human readable representation
+   */
+
+  public static final Long SECONDS_PER_DAY = 60 * 60 * 24L;
+
+
+  /**
 {code}

TTL is only related to column descriptor. I'm suprised there is no constant for that elsewhere?
{code}
+  /**
+   *  TTL related constants for human readable representation
+   */
+  public static final Long SECONDS_PER_DAY = 60 * 60 * 24L;
+  public static final String TTL = "TTL";
+
{code}

Also consider passing in the string buffer instead of creating a new one in each of the helper
methods.

> Pretty print TTL
> ----------------
>
>                 Key: HBASE-6990
>                 URL: https://issues.apache.org/jira/browse/HBASE-6990
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Jean-Daniel Cryans
>            Assignee: Esteban Gutierrez
>            Priority: Minor
>         Attachments: HBASE-6990.v0.patch, HBASE-6990.v1.patch, HBASE-6990.v2.patch
>
>
> I've seen a lot of users getting confused by the TTL configuration and I think that if
we just pretty printed it it would solve most of the issues. For example, let's say a user
wanted to set a TTL of 90 days. That would be 7776000. But let's say that it was typo'd to
77760000 instead, it gives you 900 days!
> So when we print the TTL we could do something like "x days, x hours, x minutes, x seconds
(real_ttl_value)". This would also help people when they use ms instead of seconds as they
would see really big values in there.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message