pool: New hotfile show command, and show enablement status with info -a#8067
pool: New hotfile show command, and show enablement status with info -a#8067greenc-FNAL wants to merge 1 commit into11.2from
hotfile show command, and show enablement status with info -a#8067Conversation
…fo -a`
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
There was a problem hiding this comment.
Pull request overview
Adds improved admin visibility into hot-file replication by introducing a consolidated hotfile show command and surfacing hot-file replication enablement in info -a pool details.
Changes:
- Added
hotfile showadmin command to display hot-file replication parameters (replicas,threshold). - Extended pool “details” output (
info -a) to include “Hot File Replication : ON|OFF”. - Added a unit test to verify the pool details output includes the hot-file replication status line.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| modules/dcache/src/main/java/org/dcache/pool/migration/MigrationModule.java | Adds hotfile show command to display hot-file replication parameters. |
| modules/dcache/src/main/java/org/dcache/pool/json/PoolDataDetails.java | Adds hot-file replication enabled flag and prints it in pool details output (plus aligns labels). |
| modules/dcache/src/main/java/org/dcache/pool/classic/PoolV4.java | Populates PoolDataDetails with the pool’s hot-file replication enablement state. |
| modules/dcache/src/test/java/org/dcache/pool/json/PoolDataDetailsTest.java | New test verifying the printed pool details includes hot-file replication status. |
| @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<String> { | ||
|
|
||
| @Override | ||
| public String call() { | ||
| return "replicas=" + hotFileReplicaCount + " threshold=" + hotFileThreshold; | ||
| } |
There was a problem hiding this comment.
The @Command description claims this command shows whether hot-file replication is enabled, but the call() output only includes replicas and threshold. Either include the enablement state in the output (and obtain it from the appropriate component) or update the command description/hint to match what is actually returned.
| 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")); |
There was a problem hiding this comment.
The assertion messages have inconsistent wording and extra whitespace (e.g., double spaces and "Hotfile" vs "Hot File"). Cleaning these up will make failures easier to read and avoids introducing typos into the test suite.
| 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")); | |
| 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 Hot File Replication status", output.contains("Hot File Replication : OFF")); |
| 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); |
There was a problem hiding this comment.
PrintWriter is never flushed/closed in this test. While StringWriter typically works without it, explicitly flushing (or using try-with-resources) makes the test more robust and avoids subtle issues if the implementation changes.
| 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); | |
| } | |
| String output = sw.toString(); | |
| assertTrue("Output should contain Hot File Replication status", output.contains("Hot File Replication : ON")); | |
| details.setHotFileReplicationEnabled(false); | |
| sw = new StringWriter(); | |
| try (PrintWriter pw = new PrintWriter(sw)) { | |
| details.print(pw); | |
| } |
Motivation:
It is desirable to have a single admin command to display the values of both hot-file migration parameters (
replicasandthreshold).It is also desirable to see quickly whether the hot file migration facility is enabled on a given pool.
Modification:
hotfile showtoMigrationModulepoolsection ofinfo -aResult:
hotfile showinfo -aAcked-by: Dmitry Litvintsev
Patch: https://rb.dcache.org/r/14640/diff/raw
Commit:
Target: master
Request: 11.2
Require-book: no
Require-notes: yes