diff --git a/modules/dcache-spacemanager/src/main/java/diskCacheV111/services/space/SpaceManagerService.java b/modules/dcache-spacemanager/src/main/java/diskCacheV111/services/space/SpaceManagerService.java index 90922d32dc0..5a94e74f091 100644 --- a/modules/dcache-spacemanager/src/main/java/diskCacheV111/services/space/SpaceManagerService.java +++ b/modules/dcache-spacemanager/src/main/java/diskCacheV111/services/space/SpaceManagerService.java @@ -776,7 +776,14 @@ private void transferFinished(DoorTransferFinishedMessage finished) */ fileRemoved(finished.getPnfsId()); } else { - transferFinished(finished.getPnfsId(), finished.getFileAttributes().getSize()); + long fileSize = 0; + if (finished.getFileAttributes().isDefined(FileAttribute.SIZE)) { + fileSize = finished.getFileAttributes().getSize(); + } else { + LOGGER.warn("Transfer " + (finished.getReturnCode() == 0 ? "succeeded " : "failed ") + + "and did not report a file size. Reporting as zero bytes."); + } + transferFinished(finished.getPnfsId(), fileSize); } } diff --git a/modules/dcache/src/main/java/org/dcache/pool/repository/v5/WriteHandleImpl.java b/modules/dcache/src/main/java/org/dcache/pool/repository/v5/WriteHandleImpl.java index 1820c7913cc..e39e1635e06 100644 --- a/modules/dcache/src/main/java/org/dcache/pool/repository/v5/WriteHandleImpl.java +++ b/modules/dcache/src/main/java/org/dcache/pool/repository/v5/WriteHandleImpl.java @@ -302,10 +302,11 @@ private synchronized void fail() { } /* If nothing was uploaded, we delete the replica and leave the name space - * entry it is virgin state. + * entry in its virgin state except for setting the file size to zero. */ long length = _entry.getReplicaSize(); if (length == 0) { + _fileAttributes.setSize(length); _targetState = ReplicaState.REMOVED; if (why == null) { why = "replica is empty";