Skip to content

Commit ef40ce1

Browse files
committed
Bulk: remove skipIfOnline method from PinManagerActivity
Motivation: as per ticket #10647 some files are showing skipped when trying to stage them Modification: removal of skipIfOnline method. To create a permanent pin use lifetime=-1 AND lifetimeUnit=MILLISECONDS. Result: files are stageable Acked-by:Tigran Mkrtchyan Target: master, 10.2, 11.0 Require-book: no Require-notes: no
1 parent 0b30436 commit ef40ce1

File tree

3 files changed

+8
-27
lines changed

3 files changed

+8
-27
lines changed

modules/dcache-bulk/src/main/java/org/dcache/services/bulk/activity/plugin/pin/PinActivity.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
7474
import java.net.URI;
7575
import java.net.URISyntaxException;
7676
import java.util.Map;
77-
import java.util.Optional;
7877
import java.util.concurrent.TimeUnit;
7978
import org.dcache.pinmanager.PinManagerPinMessage;
8079
import org.dcache.services.bulk.BulkServiceException;
@@ -123,11 +122,6 @@ public ListenableFuture<Message> perform(String rid, long tid, String prefix, Fs
123122
lifetimeInMillis);
124123
message.setSubject(subject);
125124

126-
Optional<ListenableFuture<Message>> skipOption = skipIfOnline(attributes, message);
127-
if (skipOption.isPresent()) {
128-
return skipOption.get();
129-
}
130-
131125
return pinManager.send(message, Long.MAX_VALUE);
132126
} catch (URISyntaxException | CacheException e) {
133127
return Futures.immediateFailedFuture(e);

modules/dcache-bulk/src/main/java/org/dcache/services/bulk/activity/plugin/pin/PinManagerActivity.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
6464
import static org.dcache.services.bulk.util.BulkRequestTarget.computeFsPath;
6565
import static org.dcache.services.bulk.util.BulkRequestTarget.State.SKIPPED;
6666

67-
import com.google.common.util.concurrent.Futures;
68-
import com.google.common.util.concurrent.ListenableFuture;
69-
import diskCacheV111.util.AccessLatency;
7067
import diskCacheV111.util.CacheException;
7168
import diskCacheV111.util.FsPath;
7269
import diskCacheV111.util.NamespaceHandlerAware;
@@ -145,23 +142,16 @@ protected PinManagerUnpinMessage unpinMessage(String id, PnfsId pnfsId) {
145142
return message;
146143
}
147144

145+
/**
146+
* Only regular files get pinned
147+
* @param attributes
148+
* @throws CacheException
149+
*/
148150
protected void checkPinnable(FileAttributes attributes) throws CacheException {
149151
switch(attributes.getFileType()) {
150152
case SPECIAL:
151153
case DIR:
152154
throw new CacheException(INVALID_ARGS, "Not a regular file.");
153155
}
154156
}
155-
156-
protected Optional<ListenableFuture<Message>> skipIfOnline(FileAttributes attributes,
157-
PinManagerPinMessage message) {
158-
ListenableFuture<Message> future = null;
159-
if (attributes.getAccessLatency() == AccessLatency.ONLINE) {
160-
message.setReply();
161-
message.setLifetime(-1L);
162-
future = Futures.immediateFuture(message);
163-
}
164-
165-
return Optional.ofNullable(future);
166-
}
167157
}

modules/dcache-bulk/src/main/java/org/dcache/services/bulk/activity/plugin/pin/StageActivity.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,13 @@ public ListenableFuture<Message> perform(String rid, long tid, String prefix, Fs
119119

120120
try {
121121
/*
122-
* refetch the attributes because RP is not stored in the bulk database.
122+
* refetch the attributes because Retention Policy is not stored in the bulk database.
123123
*/
124124

125125
FsPath absolutePath = BulkRequestTarget.computeFsPath(prefix, path.toString());
126126
attributes = getAttributes(absolutePath);
127127

128+
//Checks for files' RetentionPolicy to be CUSTODIAL
128129
checkStageable(attributes);
129130

130131
PinManagerPinMessage message
@@ -134,11 +135,6 @@ public ListenableFuture<Message> perform(String rid, long tid, String prefix, Fs
134135
getLifetimeInMillis(path));
135136
message.setSubject(subject);
136137

137-
Optional<ListenableFuture<Message>> skipOption = skipIfOnline(attributes, message);
138-
if (skipOption.isPresent()) {
139-
return skipOption.get();
140-
}
141-
142138
return pinManager.send(message, Long.MAX_VALUE);
143139
} catch (URISyntaxException | CacheException e) {
144140
return Futures.immediateFailedFuture(e);
@@ -177,6 +173,7 @@ private long getLifetimeInMillis(FsPath path) {
177173
}
178174

179175
private void checkStageable(FileAttributes attributes) throws CacheException {
176+
//check if it's a regular file
180177
checkPinnable(attributes);
181178

182179
if (attributes.getRetentionPolicy() != RetentionPolicy.CUSTODIAL) {

0 commit comments

Comments
 (0)