dCache / xrootd4j

Implementation of the xrootd data access protocol in Java
Other
3 stars 8 forks source link

xrootd4j: get source size from stat on open on TPC #92

Closed alrossi closed 3 years ago

alrossi commented 3 years ago

Motivation:

In the original xroot TPC protocol, the client opens the source file before handing off the TPC request to the destination. As a result, the size of the file as discovered by the client becomes a part of the opaque data (as the 'oss.asize' CGI element).

When delegation was introduced, and with it the so-called "TPC lite" protocol, the open became facultative. It so happens that the later versions of the client still do this, but it is no longer required.

When testing TLS, I happened to uncover what SLAC has now acknowledged to be a bug: using 'xroots' rather than 'xroot' as the URL protocol for the source makes the client skip opening the file. While they have corrected this bug, the absence of the 'oss.asize' (it was 0), which led to the TPC client delivering only one block of the file (4MB) because it had no expected file size to work with, drove home the point that the TPC client should not rely on the opaque data for size, but should take it from the stat info returned from the source on open.

Modification:

Parse the returned info bytes into FileStatus on the open response. Access this info for the file size. Use this to override oss.asize if present, or in place of it if absent. Change oss.asize in the TPC info to Long so that a null check can be performed.

Result:

Correct behavior (complete file read) even if oss.asize is not set.

Target: master Request: 4.0 Request: 3.5 Patch: https://rb.dcache.org/r/12907 Acked-by: Dmitry