Skip to content

Commit

Permalink
Fix log message containing invalid access latency and retention polic…
Browse files Browse the repository at this point in the history
…y 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/
  • Loading branch information
gbehrmann committed Nov 22, 2013
1 parent ccd9cb1 commit efd4dee
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
Expand Up @@ -35,6 +35,7 @@
import diskCacheV111.vehicles.PoolManagerPoolInformation;
import diskCacheV111.vehicles.ProtocolInfo;
import diskCacheV111.vehicles.StorageInfo;
import diskCacheV111.vehicles.StorageInfos;

import dmg.cells.nucleus.CellMessage;

Expand Down Expand Up @@ -148,7 +149,7 @@ private PoolPreferenceLevel[] match(DirectionType direction)
return _selectionUnit.match(direction,
hostName,
protocol,
_fileAttributes.getStorageInfo(),
StorageInfos.extractFrom(_fileAttributes),
_linkGroup);
}

Expand Down Expand Up @@ -182,7 +183,7 @@ public PoolInfo selectWritePool(long preallocated)
if (levels.length == 0) {
throw new CacheException(19,
"No write pools configured for <" +
_fileAttributes.getStorageInfo() +
StorageInfos.extractFrom(_fileAttributes) +
"> in the linkGroup " +
(_linkGroup == null ? "[none]" : _linkGroup));
}
Expand All @@ -198,7 +199,7 @@ public PoolInfo selectWritePool(long preallocated)
}

throw new CacheException(20,
"No write pool available for <" + _fileAttributes.getStorageInfo() +
"No write pool available for <" + StorageInfos.extractFrom(_fileAttributes) +
"> in the linkGroup " +
(_linkGroup == null ? "[none]" : _linkGroup));
}
Expand Down Expand Up @@ -516,7 +517,7 @@ public static Set<FileAttribute> getRequiredAttributesForFileLocality()
return FileLocality.NONE;
}

StorageInfo storageInfo = attributes.getStorageInfo();
StorageInfo storageInfo = StorageInfos.extractFrom(attributes);
PoolPreferenceLevel[] levels =
_selectionUnit.match(DirectionType.READ,
hostName,
Expand Down
Expand Up @@ -16,6 +16,7 @@
import diskCacheV111.util.CacheException;
import diskCacheV111.util.FileNotInCacheException;
import diskCacheV111.util.PnfsId;
import diskCacheV111.vehicles.StorageInfos;

import dmg.util.Args;
import dmg.util.Formats;
Expand Down Expand Up @@ -258,7 +259,7 @@ public String ac_sweeper_ls(Args args)
if (s) {
FileAttributes attributes = entry.getFileAttributes();
if (attributes.isDefined(FileAttribute.STORAGEINFO)) {
sb.append("\n ").append(attributes.getStorageInfo());
sb.append("\n ").append(StorageInfos.extractFrom(attributes));
}
}
sb.append("\n");
Expand Down
Expand Up @@ -23,6 +23,7 @@
import diskCacheV111.vehicles.DCapClientProtocolInfo;
import diskCacheV111.vehicles.ProtocolInfo;
import diskCacheV111.vehicles.StorageInfo;
import diskCacheV111.vehicles.StorageInfos;

import dmg.cells.nucleus.CellEndpoint;
import dmg.cells.nucleus.CellMessage;
Expand Down Expand Up @@ -74,7 +75,7 @@ public void runIO(FileAttributes fileAttributes,
throws Exception
{
PnfsId pnfsId = fileAttributes.getPnfsId();
StorageInfo storage = fileAttributes.getStorageInfo();
StorageInfo storage = StorageInfos.extractFrom(fileAttributes);
say("runIO()\n\tprotocol="+
protocol+",\n\tStorageInfo="+storage+",\n\tPnfsId="+pnfsId+
",\n\taccess ="+access);
Expand Down
Expand Up @@ -90,6 +90,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
import diskCacheV111.util.PnfsId;
import diskCacheV111.vehicles.ProtocolInfo;
import diskCacheV111.vehicles.StorageInfo;
import diskCacheV111.vehicles.StorageInfos;
import diskCacheV111.vehicles.transferManager.RemoteGsiftpTransferProtocolInfo;

import dmg.cells.nucleus.CellEndpoint;
Expand Down Expand Up @@ -174,11 +175,12 @@ public void runIO(FileAttributes fileAttributes,
CredentialException, GSSException
{
_pnfsId = fileAttributes.getPnfsId();
StorageInfo storage = fileAttributes.getStorageInfo();
_log.debug("runIO()\n\tprotocol="
+ protocol + ",\n\tStorageInfo=" + storage + ",\n\tPnfsId="
+ _pnfsId + ",\n\taccess ="
+ access );
if (_log.isDebugEnabled()) {
_log.debug("runIO()\n\tprotocol="
+ protocol + ",\n\tStorageInfo=" + StorageInfos.extractFrom(fileAttributes) + ",\n\tPnfsId="
+ _pnfsId + ",\n\taccess ="
+ access );
}
if (!(protocol instanceof RemoteGsiftpTransferProtocolInfo)) {
throw new CacheException("protocol info is not RemoteGsiftpransferProtocolInfo");
}
Expand All @@ -203,11 +205,11 @@ public void runIO(FileAttributes fileAttributes,

if ( access == IoMode.WRITE) {
gridFTPRead(remoteGsiftpProtocolInfo,
storage,
fileAttributes.getStorageInfo(),
allocator);
} else {
gridFTPWrite(remoteGsiftpProtocolInfo,
storage);
fileAttributes.getStorageInfo());
}
_log.debug(" runIO() done");
}
Expand Down
Expand Up @@ -16,7 +16,7 @@
import diskCacheV111.util.PnfsId;
import diskCacheV111.vehicles.ProtocolInfo;
import diskCacheV111.vehicles.RemoteHttpDataTransferProtocolInfo;
import diskCacheV111.vehicles.StorageInfo;
import diskCacheV111.vehicles.StorageInfos;

import dmg.cells.nucleus.CellEndpoint;

Expand Down Expand Up @@ -49,9 +49,10 @@ public void runIO(FileAttributes fileAttributes,
throws CacheException, IOException, InterruptedException
{
PnfsId pnfsId = fileAttributes.getPnfsId();
StorageInfo storage = fileAttributes.getStorageInfo();
_log.info("Active HTTP: Protocol={}, StorageInfo={}, PnfsId={}, Access={}",
protocol, storage, pnfsId, access);
if (_log.isInfoEnabled()) {
_log.info("Active HTTP: Protocol={}, StorageInfo={}, PnfsId={}, Access={}",
protocol, StorageInfos.extractFrom(fileAttributes), pnfsId, access);
}
if (!(protocol instanceof RemoteHttpDataTransferProtocolInfo)) {
throw new CacheException("protocol info is not RemoteHttpDataTransferProtocolInfo");
}
Expand Down

0 comments on commit efd4dee

Please sign in to comment.