This is an automated email from the ASF dual-hosted git repository.
ayushtkn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 2fff23ec523 HIVE-28405: Align hive.repl.cm.retain declared time unit
with metastore (documentation only) (#6682)
2fff23ec523 is described below
commit 2fff23ec5237c9dc6fa9d6caf1eabc4439f36c60
Author: srbiswal <[email protected]>
AuthorDate: Mon Aug 24 19:37:05 2026 +0530
HIVE-28405: Align hive.repl.cm.retain declared time unit with metastore
(documentation only) (#6682)
---
.../java/org/apache/hadoop/hive/conf/HiveConf.java | 7 ++++---
.../org/apache/hadoop/hive/conf/TestHiveConf.java | 19 +++++++++++++++++++
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 301adc2c895..7c0735dd21b 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -402,9 +402,10 @@ public static enum ConfVars {
"Turn on ChangeManager, so delete files will go to cmrootdir."),
REPL_CM_DIR("hive.repl.cmrootdir","/user/${system:user.name}/cmroot/",
"Root dir for ChangeManager, used for deleted files."),
- REPL_CM_RETAIN("hive.repl.cm.retain","10d",
- new TimeValidator(TimeUnit.DAYS),
- "Time to retain removed files in cmrootdir."),
+ REPL_CM_RETAIN("hive.repl.cm.retain","240h",
+ new TimeValidator(TimeUnit.HOURS),
+ "Time to retain removed files in cmrootdir. A unit-less value is
interpreted in hours, "
+ + "matching the metastore counterpart metastore.repl.cm.retain.
Default is 240h (10 days)."),
REPL_CM_ENCRYPTED_DIR("hive.repl.cm.encryptionzone.rootdir", ".cmroot",
"Root dir for ChangeManager if encryption zones are enabled, used
for deleted files."),
REPL_CM_FALLBACK_NONENCRYPTED_DIR("hive.repl.cm.nonencryptionzone.rootdir",
diff --git a/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java
b/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java
index ff1deb631b9..6fcfa335dfb 100644
--- a/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java
+++ b/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java
@@ -125,6 +125,25 @@ public void testUnitFor() throws Exception {
Assert.assertEquals(TimeUnit.NANOSECONDS, HiveConf.unitFor("nsecs", null));
}
+ @Test
+ public void testReplCmRetainTimeUnit() {
+ HiveConf conf = new HiveConf();
+
+ // The default (240h) is 10 days. Guards against accidentally changing the
default duration.
+ Assert.assertEquals(10, conf.getTimeVar(ConfVars.REPL_CM_RETAIN,
TimeUnit.DAYS));
+ Assert.assertEquals(240, conf.getTimeVar(ConfVars.REPL_CM_RETAIN,
TimeUnit.HOURS));
+
+ // A unit-less value is interpreted in hours, matching the metastore
counterpart
+ // metastore.repl.cm.retain, which uses a HOURS base unit.
+ Assert.assertEquals(TimeUnit.HOURS,
HiveConf.getDefaultTimeUnit(ConfVars.REPL_CM_RETAIN));
+ conf.setVar(ConfVars.REPL_CM_RETAIN, "10");
+ Assert.assertEquals(10, conf.getTimeVar(ConfVars.REPL_CM_RETAIN,
TimeUnit.HOURS));
+
+ // An explicit unit suffix is still honoured.
+ conf.setVar(ConfVars.REPL_CM_RETAIN, "10d");
+ Assert.assertEquals(10, conf.getTimeVar(ConfVars.REPL_CM_RETAIN,
TimeUnit.DAYS));
+ }
+
@Test
public void testToSizeBytes() throws Exception {
Assert.assertEquals(1L, HiveConf.toSizeBytes("1b"));