From c0b5e962c7afe70590d0702ab7d8f3edb0128ca2 Mon Sep 17 00:00:00 2001 From: chaijunjie0101 <64140218+chaijunjie0101@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:32:19 +0800 Subject: [PATCH] HBASE-28185 Alter table to set TTL using hbase shell failed when ttl string is not match format (#5494) Signed-off-by: Duo Zhang (cherry picked from commit 027a119bcf495e18b3e0fa4984f8982b9ed1390d) --- .../main/java/org/apache/hadoop/hbase/util/PrettyPrinter.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/PrettyPrinter.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/PrettyPrinter.java index f73064f70a8e..1b19bd25287c 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/PrettyPrinter.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/PrettyPrinter.java @@ -184,7 +184,11 @@ private static long humanReadableIntervalToSec(final String humanReadableInterva hours = matcher.group(6); minutes = matcher.group(8); seconds = matcher.group(10); + } else { + LOG.warn("Given interval value '{}' is not a number and does not match human readable format," + + " value will be set to 0.", humanReadableInterval); } + ttl = 0; ttl += days != null ? Long.parseLong(days) * HConstants.DAY_IN_SECONDS : 0; ttl += hours != null ? Long.parseLong(hours) * HConstants.HOUR_IN_SECONDS : 0;