Skip to content

Commit 8528738

Browse files
committed
pool: New hotfile show command, and show enablement status with info -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
1 parent 46aae42 commit 8528738

4 files changed

Lines changed: 64 additions & 11 deletions

File tree

modules/dcache/src/main/java/org/dcache/pool/classic/PoolV4.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ public PoolDataDetails getDataObject() {
662662
info.setPingHeartbeatInSecs(_pingThread.getHeartbeat());
663663
info.setP2pFileMode(_p2pFileMode == P2P_PRECIOUS ?
664664
P2PMode.PRECIOUS : P2PMode.CACHED);
665+
info.setHotFileReplicationEnabled(_hotFileReplicationEnabled);
665666
info.setPoolMode(_poolMode.toString());
666667
if (_poolMode.isDisabled()) {
667668
info.setPoolStatusCode(_poolStatusCode);

modules/dcache/src/main/java/org/dcache/pool/json/PoolDataDetails.java

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public enum P2PMode {
112112
private Lsf largeFileStore;
113113

114114
private P2PMode p2pFileMode;
115+
private boolean isHotFileReplicationEnabled;
115116
private Integer hybridInventory;
116117

117118
private int errorCode;
@@ -159,6 +160,10 @@ public P2PMode getP2pFileMode() {
159160
return p2pFileMode;
160161
}
161162

163+
public boolean isHotFileReplicationEnabled() {
164+
return isHotFileReplicationEnabled;
165+
}
166+
162167
public Integer getPingHeartbeatInSecs() {
163168
return pingHeartbeatInSecs;
164169
}
@@ -196,22 +201,23 @@ private String asOnOff(boolean value) {
196201
}
197202

198203
public void print(PrintWriter pw) {
199-
pw.println("Base directory : " + baseDir);
200-
pw.println("Version : " + poolVersion);
201-
pw.println("Report remove : " + asOnOff(isRemovalReported));
202-
pw.println("Pool Mode : " + poolMode);
204+
pw.println("Base directory : " + baseDir);
205+
pw.println("Version : " + poolVersion);
206+
pw.println("Report remove : " + asOnOff(isRemovalReported));
207+
pw.println("Pool Mode : " + poolMode);
203208
if (poolStatusCode != null) {
204-
pw.println("Detail : [" + poolStatusCode + "] "
209+
pw.println("Detail : [" + poolStatusCode + "] "
205210
+ poolStatusMessage);
206211
}
207-
pw.println("Hsm Load Suppr. : " + asOnOff(isHsmLoadSuppressed));
208-
pw.println("Ping Heartbeat : " + pingHeartbeatInSecs + " seconds");
209-
pw.println("Breakeven : " + breakEven);
210-
pw.println("LargeFileStore : " + largeFileStore);
211-
pw.println("P2P File Mode : " + p2pFileMode);
212+
pw.println("Hsm Load Suppression : " + asOnOff(isHsmLoadSuppressed));
213+
pw.println("Ping Heartbeat : " + pingHeartbeatInSecs + " seconds");
214+
pw.println("Breakeven : " + breakEven);
215+
pw.println("LargeFileStore : " + largeFileStore);
216+
pw.println("P2P File Mode : " + p2pFileMode);
217+
pw.println("Hot File Replication : " + asOnOff(isHotFileReplicationEnabled));
212218

213219
if (hybridInventory != null) {
214-
pw.println("Inventory : " + hybridInventory);
220+
pw.println("Inventory : " + hybridInventory);
215221
}
216222

217223
if (costData != null) {
@@ -269,6 +275,10 @@ public void setP2pFileMode(
269275
this.p2pFileMode = p2pFileMode;
270276
}
271277

278+
public void setHotFileReplicationEnabled(boolean isEnabled) {
279+
this.isHotFileReplicationEnabled = isEnabled;
280+
}
281+
272282
public void setPingHeartbeatInSecs(Integer pingHeartbeatInSecs) {
273283
this.pingHeartbeatInSecs = pingHeartbeatInSecs;
274284
}

modules/dcache/src/main/java/org/dcache/pool/migration/MigrationModule.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,4 +1634,17 @@ public String call() {
16341634
return "Current threshold: " + getThreshold();
16351635
}
16361636
}
1637+
1638+
@Command(name = "hotfile show",
1639+
description = "Show the current status of the hot-file replication facility, "
1640+
+ "including whether it is enabled and the values of the 'replicas' "
1641+
+ "and 'threshold' parameters.",
1642+
hint = "Show hot-file replication status.")
1643+
public class HotfileShowCommand implements Callable<String> {
1644+
1645+
@Override
1646+
public String call() {
1647+
return "replicas=" + hotFileReplicaCount + " threshold=" + hotFileThreshold;
1648+
}
1649+
}
16371650
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.dcache.pool.json;
2+
3+
import org.junit.Test;
4+
import java.io.PrintWriter;
5+
import java.io.StringWriter;
6+
import static org.junit.Assert.assertTrue;
7+
8+
public class PoolDataDetailsTest {
9+
10+
@Test
11+
public void shouldPrintHotfileReplicationStatus() {
12+
PoolDataDetails details = new PoolDataDetails();
13+
details.setHotFileReplicationEnabled(true);
14+
15+
StringWriter sw = new StringWriter();
16+
PrintWriter pw = new PrintWriter(sw);
17+
details.print(pw);
18+
19+
String output = sw.toString();
20+
assertTrue("Output should contain Hot File Replication status", output.contains("Hot File Replication : ON"));
21+
22+
details.setHotFileReplicationEnabled(false);
23+
sw = new StringWriter();
24+
pw = new PrintWriter(sw);
25+
details.print(pw);
26+
output = sw.toString();
27+
assertTrue("Output should contain HotFile Replication status", output.contains("Hot File Replication : OFF"));
28+
}
29+
}

0 commit comments

Comments
 (0)