From 6d9da1314b683f53514726a1dfcbee8ab434c9c1 Mon Sep 17 00:00:00 2001 From: Joel Swiatek Date: Tue, 23 Nov 2021 22:44:50 -0800 Subject: [PATCH] HBASE-26458 Add UNSET_SNAPSHOT_PROP and fix TTL defaulting (#3857) Signed-off-by: Viraj Jasani --- .../main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java | 5 ++++- src/main/asciidoc/_chapters/ops_mgt.adoc | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java index 5742918ec43..0fb43b3a486 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java @@ -3712,7 +3712,10 @@ public class HBaseAdmin implements Admin { builder.setTable(tableName.getNameAsString()); builder.setName(snapshotName); builder.setType(type); - builder.setTtl(getTtlFromSnapshotProps(snapshotProps)); + long ttl = getTtlFromSnapshotProps(snapshotProps); + if (ttl != -1L && ttl < TimeUnit.MILLISECONDS.toSeconds(Long.MAX_VALUE)) { + builder.setTtl(ttl); + } snapshot(builder.build()); } diff --git a/src/main/asciidoc/_chapters/ops_mgt.adoc b/src/main/asciidoc/_chapters/ops_mgt.adoc index 6f60a42a789..f2a25ca5f28 100644 --- a/src/main/asciidoc/_chapters/ops_mgt.adoc +++ b/src/main/asciidoc/_chapters/ops_mgt.adoc @@ -2224,7 +2224,6 @@ Value 0 for this config indicates TTL: FOREVER - .Enable/Disable Snapshot Auto Cleanup on running cluster: By default, snapshot auto cleanup based on TTL would be enabled