Skip to content

Commit 107116e

Browse files
committed
Fix log message containing invalid access latency and retention policy values
Addresses an issue in which log messages would show values for access latency and retention policy from uninitialized fields, rather than the actual values of the file the log message is refering to. The regression was introduced when these fields got deprecated in storage info. dCache doesn't make use of the fields anymore, however they still appear in the toString version of storage info and thus appear in various log outputs and error message. Target: trunk Request: 2.7 Request: 2.6 Require-notes: yes Require-book: no Acked-by: Paul Millar <paul.millar@desy.de> Patch: http://rb.dcache.org/r/6273/ (cherry picked from commit efd4dee) Conflicts: modules/dcache/src/main/java/org/dcache/pool/movers/RemoteHttpDataTransferProtocol_1.java
1 parent e0c0eb3 commit 107116e

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed

modules/dcache/src/main/java/diskCacheV111/poolManager/PoolMonitorV5.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import diskCacheV111.vehicles.PoolManagerPoolInformation;
3434
import diskCacheV111.vehicles.ProtocolInfo;
3535
import diskCacheV111.vehicles.StorageInfo;
36+
import diskCacheV111.vehicles.StorageInfos;
3637

3738
import dmg.cells.nucleus.CellMessage;
3839

@@ -146,7 +147,7 @@ private PoolPreferenceLevel[] match(DirectionType direction)
146147
return _selectionUnit.match(direction,
147148
hostName,
148149
protocol,
149-
_fileAttributes.getStorageInfo(),
150+
StorageInfos.extractFrom(_fileAttributes),
150151
_linkGroup);
151152
}
152153

@@ -180,7 +181,7 @@ public PoolInfo selectWritePool(long preallocated)
180181
if (levels.length == 0) {
181182
throw new CacheException(19,
182183
"No write pools configured for <" +
183-
_fileAttributes.getStorageInfo() +
184+
StorageInfos.extractFrom(_fileAttributes) +
184185
"> in the linkGroup " +
185186
(_linkGroup == null ? "[none]" : _linkGroup));
186187
}
@@ -196,7 +197,7 @@ public PoolInfo selectWritePool(long preallocated)
196197
}
197198

198199
throw new CacheException(20,
199-
"No write pool available for <" + _fileAttributes.getStorageInfo() +
200+
"No write pool available for <" + StorageInfos.extractFrom(_fileAttributes) +
200201
"> in the linkGroup " +
201202
(_linkGroup == null ? "[none]" : _linkGroup));
202203
}
@@ -525,7 +526,7 @@ public static Set<FileAttribute> getRequiredAttributesForFileLocality()
525526
return FileLocality.NONE;
526527
}
527528

528-
StorageInfo storageInfo = attributes.getStorageInfo();
529+
StorageInfo storageInfo = StorageInfos.extractFrom(attributes);
529530
PoolPreferenceLevel[] levels =
530531
_selectionUnit.match(DirectionType.READ,
531532
hostName,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import diskCacheV111.util.CacheException;
1717
import diskCacheV111.util.FileNotInCacheException;
1818
import diskCacheV111.util.PnfsId;
19+
import diskCacheV111.vehicles.StorageInfos;
1920

2021
import dmg.util.Args;
2122
import dmg.util.Formats;
@@ -258,7 +259,7 @@ public String ac_sweeper_ls(Args args)
258259
if (s) {
259260
FileAttributes attributes = entry.getFileAttributes();
260261
if (attributes.isDefined(FileAttribute.STORAGEINFO)) {
261-
sb.append("\n ").append(attributes.getStorageInfo());
262+
sb.append("\n ").append(StorageInfos.extractFrom(attributes));
262263
}
263264
}
264265
sb.append("\n");

modules/dcache/src/main/java/org/dcache/pool/movers/DCapClientProtocol_1.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import diskCacheV111.vehicles.DCapClientProtocolInfo;
2424
import diskCacheV111.vehicles.ProtocolInfo;
2525
import diskCacheV111.vehicles.StorageInfo;
26+
import diskCacheV111.vehicles.StorageInfos;
2627

2728
import dmg.cells.nucleus.CellEndpoint;
2829
import dmg.cells.nucleus.CellMessage;
@@ -74,7 +75,7 @@ public void runIO(FileAttributes fileAttributes,
7475
throws Exception
7576
{
7677
PnfsId pnfsId = fileAttributes.getPnfsId();
77-
StorageInfo storage = fileAttributes.getStorageInfo();
78+
StorageInfo storage = StorageInfos.extractFrom(fileAttributes);
7879
say("runIO()\n\tprotocol="+
7980
protocol+",\n\tStorageInfo="+storage+",\n\tPnfsId="+pnfsId+
8081
",\n\taccess ="+access);

modules/dcache/src/main/java/org/dcache/pool/movers/RemoteGsiftpTransferProtocol_1.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
9090
import diskCacheV111.util.PnfsId;
9191
import diskCacheV111.vehicles.ProtocolInfo;
9292
import diskCacheV111.vehicles.StorageInfo;
93+
import diskCacheV111.vehicles.StorageInfos;
9394
import diskCacheV111.vehicles.transferManager.RemoteGsiftpTransferProtocolInfo;
9495

9596
import dmg.cells.nucleus.CellEndpoint;
@@ -174,11 +175,12 @@ public void runIO(FileAttributes fileAttributes,
174175
CredentialException, GSSException
175176
{
176177
_pnfsId = fileAttributes.getPnfsId();
177-
StorageInfo storage = fileAttributes.getStorageInfo();
178-
_log.debug("runIO()\n\tprotocol="
179-
+ protocol + ",\n\tStorageInfo=" + storage + ",\n\tPnfsId="
180-
+ _pnfsId + ",\n\taccess ="
181-
+ access );
178+
if (_log.isDebugEnabled()) {
179+
_log.debug("runIO()\n\tprotocol="
180+
+ protocol + ",\n\tStorageInfo=" + StorageInfos.extractFrom(fileAttributes) + ",\n\tPnfsId="
181+
+ _pnfsId + ",\n\taccess ="
182+
+ access );
183+
}
182184
if (!(protocol instanceof RemoteGsiftpTransferProtocolInfo)) {
183185
throw new CacheException("protocol info is not RemoteGsiftpransferProtocolInfo");
184186
}
@@ -203,11 +205,11 @@ public void runIO(FileAttributes fileAttributes,
203205

204206
if ( access == IoMode.WRITE) {
205207
gridFTPRead(remoteGsiftpProtocolInfo,
206-
storage,
208+
fileAttributes.getStorageInfo(),
207209
allocator);
208210
} else {
209211
gridFTPWrite(remoteGsiftpProtocolInfo,
210-
storage);
212+
fileAttributes.getStorageInfo());
211213
}
212214
_log.debug(" runIO() done");
213215
}

modules/dcache/src/main/java/org/dcache/pool/movers/RemoteHttpDataTransferProtocol_1.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import diskCacheV111.util.PnfsId;
1717
import diskCacheV111.vehicles.ProtocolInfo;
1818
import diskCacheV111.vehicles.RemoteHttpDataTransferProtocolInfo;
19-
import diskCacheV111.vehicles.StorageInfo;
19+
import diskCacheV111.vehicles.StorageInfos;
2020

2121
import dmg.cells.nucleus.CellEndpoint;
2222

@@ -49,9 +49,10 @@ public void runIO(FileAttributes fileAttributes,
4949
throws CacheException, IOException, InterruptedException
5050
{
5151
PnfsId pnfsId = fileAttributes.getPnfsId();
52-
StorageInfo storage = fileAttributes.getStorageInfo();
53-
_log.info("Active HTTP: Protocol={}, StorageInfo={}, PnfsId={}, Access={}",
54-
new Object[] { protocol, storage, pnfsId, access });
52+
if (_log.isInfoEnabled()) {
53+
_log.info("Active HTTP: Protocol={}, StorageInfo={}, PnfsId={}, Access={}",
54+
protocol, StorageInfos.extractFrom(fileAttributes), pnfsId, access);
55+
}
5556
if (!(protocol instanceof RemoteHttpDataTransferProtocolInfo)) {
5657
throw new CacheException("protocol info is not RemoteHttpDataTransferProtocolInfo");
5758
}

0 commit comments

Comments
 (0)