Skip to content

Commit

Permalink
dcache (qos): move required attributes to Transfer.readNamespaceAttri…
Browse files Browse the repository at this point in the history
…butesAsync

Motivation:

In order to convey the new QOS attributes
to the pool on the write of a new file,
these were added by https://rb.dcache.org/r/14066/
`dcache,pnfs: implement qos policy support (qos engine 3)`
`master@e2a1f37`

to the PoolMgrSelectReadPoolMessage REQUIRED set.

However, as seen from below, upon immediate
read of an uploaded file, those attributes
may not yet be delivered.

Modification:

The proper place to add these to the
requested attribute set is in `Transfer`,
where the read in connection with file
creation is done.

Result:

No more failures to read the required
attributes, and regression checks on
assignment of policy on the basis of
directory tag still works.

Target: master
Requires-notes: no (unreleased changes)
Patch: https://rb.dcache.org/r/14092/
Acked-by: Tigran
  • Loading branch information
alrossi committed Sep 11, 2023
1 parent a1140fc commit 17453da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Expand Up @@ -10,8 +10,6 @@
import static org.dcache.namespace.FileAttribute.HSM;
import static org.dcache.namespace.FileAttribute.LOCATIONS;
import static org.dcache.namespace.FileAttribute.PNFSID;
import static org.dcache.namespace.FileAttribute.QOS_POLICY;
import static org.dcache.namespace.FileAttribute.QOS_STATE;
import static org.dcache.namespace.FileAttribute.RETENTION_POLICY;
import static org.dcache.namespace.FileAttribute.SIZE;
import static org.dcache.namespace.FileAttribute.STORAGECLASS;
Expand Down Expand Up @@ -52,7 +50,7 @@ public class PoolMgrSelectReadPoolMsg extends PoolMgrSelectPoolMsg {

private static final EnumSet<FileAttribute> REQUIRED_ATTRIBUTES =
EnumSet.of(PNFSID, STORAGEINFO, STORAGECLASS, CACHECLASS, HSM, LOCATIONS, SIZE,
ACCESS_LATENCY, RETENTION_POLICY, QOS_POLICY, QOS_STATE);
ACCESS_LATENCY, RETENTION_POLICY);

private static final long serialVersionUID = -2126253028981131441L;

Expand Down
7 changes: 6 additions & 1 deletion modules/dcache/src/main/java/org/dcache/util/Transfer.java
Expand Up @@ -9,6 +9,8 @@
import static java.util.Objects.requireNonNull;
import static org.dcache.namespace.FileAttribute.CREATION_TIME;
import static org.dcache.namespace.FileAttribute.PNFSID;
import static org.dcache.namespace.FileAttribute.QOS_POLICY;
import static org.dcache.namespace.FileAttribute.QOS_STATE;
import static org.dcache.namespace.FileAttribute.SIZE;
import static org.dcache.namespace.FileAttribute.STORAGEINFO;
import static org.dcache.namespace.FileAttribute.TYPE;
Expand Down Expand Up @@ -63,7 +65,6 @@
import java.time.Duration;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.OptionalLong;
import java.util.Set;
Expand Down Expand Up @@ -103,6 +104,9 @@ public class Transfer implements Comparable<Transfer> {

private static final BaseEncoding SESSION_ENCODING = BaseEncoding.base64().omitPadding();

private static final EnumSet<FileAttribute> QOS_ATTRIBUTES =
EnumSet.of(QOS_POLICY, QOS_STATE);

protected final PnfsHandler _pnfs;

/**
Expand Down Expand Up @@ -751,6 +755,7 @@ private ListenableFuture<Void> readNameSpaceEntryAsync(boolean allowWrite, long
attr.addAll(PoolMgrSelectReadPoolMsg.getRequiredAttributes());
Set<AccessMask> mask;
if (allowWrite) {
attr.addAll(QOS_ATTRIBUTES);
mask = EnumSet.of(AccessMask.READ_DATA, AccessMask.WRITE_DATA);
} else {
mask = EnumSet.of(AccessMask.READ_DATA);
Expand Down

0 comments on commit 17453da

Please sign in to comment.