From 0e4a57dc947c8078980768c33d0e4254202df443 Mon Sep 17 00:00:00 2001 From: Chris Green Date: Tue, 7 Apr 2026 16:59:06 -0500 Subject: [PATCH 1/3] pool: New `hotfile show` command, and show enablement status with `info -a` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Motivation: It is desirable to have a single admin command to display the values of both hot-file migration parameters (`replicas` and `threshold`). It is also desirable to see quickly whether the hot file migration facility is enabled on a given pool. Modification: - The addition of a pool command `hotfile show` to `MigrationModule` - The hot file replication enablement status has been added to the `pool` section of `info -a` Result: - `hotfile show` ``` replicas=3 threshold=5 ``` - `info -a` ``` … --- pool (Main pool component) --- Base directory : /diska/rw-pool-1 Version : 12.0.0-SNAPSHOT(bddeaa4) (Sub=4) Report remove : ON Pool Mode : enabled Hsm Load Suppression : OFF Ping Heartbeat : 30 seconds Breakeven : 0.7 LargeFileStore : NONE P2P File Mode : CACHED Hot File Replication : ON Mover Queue (DCap) 0(100)/0 Mover Queue (FTP) 0(30)/0 Mover Queue (TPC) 0(1000)/0 Mover Queue (XRootD) 0(1000)/0 Mover Queue (HTTP) 0(1000)/0 Mover Queue (NFS) 0(1000)/0 Mover Queue (regular) 0(1000)/0 Mover Queue (CVMFS) 0(10000)/0 … ``` Acked-by: Dmitry Litvintsev Patch: https://rb.dcache.org/r/14640/diff/raw Commit: Target: master Request: 11.2 Require-book: no Require-notes: yes --- .../java/org/dcache/pool/classic/PoolV4.java | 1 + .../org/dcache/pool/json/PoolDataDetails.java | 32 ++++++++++++------- .../pool/migration/MigrationModule.java | 13 ++++++++ .../dcache/pool/json/PoolDataDetailsTest.java | 29 +++++++++++++++++ 4 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java diff --git a/modules/dcache/src/main/java/org/dcache/pool/classic/PoolV4.java b/modules/dcache/src/main/java/org/dcache/pool/classic/PoolV4.java index 367afe10585..15617d982b0 100644 --- a/modules/dcache/src/main/java/org/dcache/pool/classic/PoolV4.java +++ b/modules/dcache/src/main/java/org/dcache/pool/classic/PoolV4.java @@ -662,6 +662,7 @@ public PoolDataDetails getDataObject() { info.setPingHeartbeatInSecs(_pingThread.getHeartbeat()); info.setP2pFileMode(_p2pFileMode == P2P_PRECIOUS ? P2PMode.PRECIOUS : P2PMode.CACHED); + info.setHotFileReplicationEnabled(_hotFileReplicationEnabled); info.setPoolMode(_poolMode.toString()); if (_poolMode.isDisabled()) { info.setPoolStatusCode(_poolStatusCode); diff --git a/modules/dcache/src/main/java/org/dcache/pool/json/PoolDataDetails.java b/modules/dcache/src/main/java/org/dcache/pool/json/PoolDataDetails.java index 63aed1809ef..316a5c67736 100644 --- a/modules/dcache/src/main/java/org/dcache/pool/json/PoolDataDetails.java +++ b/modules/dcache/src/main/java/org/dcache/pool/json/PoolDataDetails.java @@ -112,6 +112,7 @@ public enum P2PMode { private Lsf largeFileStore; private P2PMode p2pFileMode; + private boolean isHotFileReplicationEnabled; private Integer hybridInventory; private int errorCode; @@ -159,6 +160,10 @@ public P2PMode getP2pFileMode() { return p2pFileMode; } + public boolean isHotFileReplicationEnabled() { + return isHotFileReplicationEnabled; + } + public Integer getPingHeartbeatInSecs() { return pingHeartbeatInSecs; } @@ -196,22 +201,23 @@ private String asOnOff(boolean value) { } public void print(PrintWriter pw) { - pw.println("Base directory : " + baseDir); - pw.println("Version : " + poolVersion); - pw.println("Report remove : " + asOnOff(isRemovalReported)); - pw.println("Pool Mode : " + poolMode); + pw.println("Base directory : " + baseDir); + pw.println("Version : " + poolVersion); + pw.println("Report remove : " + asOnOff(isRemovalReported)); + pw.println("Pool Mode : " + poolMode); if (poolStatusCode != null) { - pw.println("Detail : [" + poolStatusCode + "] " + pw.println("Detail : [" + poolStatusCode + "] " + poolStatusMessage); } - pw.println("Hsm Load Suppr. : " + asOnOff(isHsmLoadSuppressed)); - pw.println("Ping Heartbeat : " + pingHeartbeatInSecs + " seconds"); - pw.println("Breakeven : " + breakEven); - pw.println("LargeFileStore : " + largeFileStore); - pw.println("P2P File Mode : " + p2pFileMode); + pw.println("Hsm Load Suppression : " + asOnOff(isHsmLoadSuppressed)); + pw.println("Ping Heartbeat : " + pingHeartbeatInSecs + " seconds"); + pw.println("Breakeven : " + breakEven); + pw.println("LargeFileStore : " + largeFileStore); + pw.println("P2P File Mode : " + p2pFileMode); + pw.println("Hot File Replication : " + asOnOff(isHotFileReplicationEnabled)); if (hybridInventory != null) { - pw.println("Inventory : " + hybridInventory); + pw.println("Inventory : " + hybridInventory); } if (costData != null) { @@ -269,6 +275,10 @@ public void setP2pFileMode( this.p2pFileMode = p2pFileMode; } + public void setHotFileReplicationEnabled(boolean isEnabled) { + this.isHotFileReplicationEnabled = isEnabled; + } + public void setPingHeartbeatInSecs(Integer pingHeartbeatInSecs) { this.pingHeartbeatInSecs = pingHeartbeatInSecs; } diff --git a/modules/dcache/src/main/java/org/dcache/pool/migration/MigrationModule.java b/modules/dcache/src/main/java/org/dcache/pool/migration/MigrationModule.java index 87fd4ba8f8e..72c1d5633f5 100644 --- a/modules/dcache/src/main/java/org/dcache/pool/migration/MigrationModule.java +++ b/modules/dcache/src/main/java/org/dcache/pool/migration/MigrationModule.java @@ -1634,4 +1634,17 @@ public String call() { return "Current threshold: " + getThreshold(); } } + + @Command(name = "hotfile show", + description = "Show the current status of the hot-file replication facility, " + + "including whether it is enabled and the values of the 'replicas' " + + "and 'threshold' parameters.", + hint = "Show hot-file replication status.") + public class HotfileShowCommand implements Callable { + + @Override + public String call() { + return "replicas=" + hotFileReplicaCount + " threshold=" + hotFileThreshold; + } + } } diff --git a/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java b/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java new file mode 100644 index 00000000000..924bffebef7 --- /dev/null +++ b/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java @@ -0,0 +1,29 @@ +package org.dcache.pool.json; + +import org.junit.Test; +import java.io.PrintWriter; +import java.io.StringWriter; +import static org.junit.Assert.assertTrue; + +public class PoolDataDetailsTest { + + @Test + public void shouldPrintHotfileReplicationStatus() { + PoolDataDetails details = new PoolDataDetails(); + details.setHotFileReplicationEnabled(true); + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + details.print(pw); + + String output = sw.toString(); + assertTrue("Output should contain Hot File Replication status", output.contains("Hot File Replication : ON")); + + details.setHotFileReplicationEnabled(false); + sw = new StringWriter(); + pw = new PrintWriter(sw); + details.print(pw); + output = sw.toString(); + assertTrue("Output should contain HotFile Replication status", output.contains("Hot File Replication : OFF")); + } +} From de051cea8fc52dc0eda7665912706a5ff4ecd4d8 Mon Sep 17 00:00:00 2001 From: Chris Green Date: Tue, 14 Apr 2026 09:05:07 -0500 Subject: [PATCH 2/3] Update modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../java/org/dcache/pool/json/PoolDataDetailsTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java b/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java index 924bffebef7..dcf8ac12592 100644 --- a/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java +++ b/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java @@ -13,16 +13,18 @@ public void shouldPrintHotfileReplicationStatus() { details.setHotFileReplicationEnabled(true); StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - details.print(pw); + try (PrintWriter pw = new PrintWriter(sw)) { + details.print(pw); + } String output = sw.toString(); assertTrue("Output should contain Hot File Replication status", output.contains("Hot File Replication : ON")); details.setHotFileReplicationEnabled(false); sw = new StringWriter(); - pw = new PrintWriter(sw); - details.print(pw); + try (PrintWriter pw = new PrintWriter(sw)) { + details.print(pw); + } output = sw.toString(); assertTrue("Output should contain HotFile Replication status", output.contains("Hot File Replication : OFF")); } From 46305e9789980ee855e9226c8de101f5e7b47007 Mon Sep 17 00:00:00 2001 From: Chris Green Date: Tue, 14 Apr 2026 09:12:18 -0500 Subject: [PATCH 3/3] Address remaining Copilot review comments manually Per: - https://github.com/dCache/dcache/pull/8067#discussion_r3048121308 - https://github.com/dCache/dcache/pull/8067#discussion_r3048121333 --- .../main/java/org/dcache/pool/migration/MigrationModule.java | 4 +--- .../test/java/org/dcache/pool/json/PoolDataDetailsTest.java | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/dcache/src/main/java/org/dcache/pool/migration/MigrationModule.java b/modules/dcache/src/main/java/org/dcache/pool/migration/MigrationModule.java index 72c1d5633f5..ef99476459b 100644 --- a/modules/dcache/src/main/java/org/dcache/pool/migration/MigrationModule.java +++ b/modules/dcache/src/main/java/org/dcache/pool/migration/MigrationModule.java @@ -1636,9 +1636,7 @@ public String call() { } @Command(name = "hotfile show", - description = "Show the current status of the hot-file replication facility, " - + "including whether it is enabled and the values of the 'replicas' " - + "and 'threshold' parameters.", + description = "Show the values of the 'replicas' and 'threshold' parameters.", hint = "Show hot-file replication status.") public class HotfileShowCommand implements Callable { diff --git a/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java b/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java index dcf8ac12592..7ab3d396c9d 100644 --- a/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java +++ b/modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java @@ -18,7 +18,7 @@ public void shouldPrintHotfileReplicationStatus() { } String output = sw.toString(); - assertTrue("Output should contain Hot File Replication status", output.contains("Hot File Replication : ON")); + assertTrue("Output should contain Hot File Replication status", output.contains("Hot File Replication : ON")); details.setHotFileReplicationEnabled(false); sw = new StringWriter(); @@ -26,6 +26,6 @@ public void shouldPrintHotfileReplicationStatus() { details.print(pw); } output = sw.toString(); - assertTrue("Output should contain HotFile Replication status", output.contains("Hot File Replication : OFF")); + assertTrue("Output should contain Hot File Replication status", output.contains("Hot File Replication : OFF")); } }