Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ccdb-local
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Costin Grigoras
ccdb-local
Commits
e3b4e187
Commit
e3b4e187
authored
2 years ago
by
Costin Grigoras
Browse files
Options
Downloads
Patches
Plain Diff
Automatically download missing local files if an AliEn replica exists
parent
f9247846
No related branches found
Branches containing commit
Tags
1.0.19
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ch/alice/o2/ccdb/servlets/SQLDownload.java
+12
-4
12 additions, 4 deletions
src/ch/alice/o2/ccdb/servlets/SQLDownload.java
with
12 additions
and
4 deletions
src/ch/alice/o2/ccdb/servlets/SQLDownload.java
+
12
−
4
View file @
e3b4e187
...
@@ -112,11 +112,17 @@ public class SQLDownload extends HttpServlet {
...
@@ -112,11 +112,17 @@ public class SQLDownload extends HttpServlet {
final
String
range
=
request
.
getHeader
(
"Range"
);
final
String
range
=
request
.
getHeader
(
"Range"
);
final
File
localFile
=
obj
.
getLocalFile
(
false
);
File
localFile
=
obj
.
getLocalFile
(
false
);
if
(
localFile
==
null
)
{
if
(
localFile
==
null
)
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
,
"The file cannot be served by this server directly, the physical copy is not on this machine"
);
// If it has an AliEn replica, and is supposed to be on the local machine then try to bring it to this server and serve it as requested
return
;
if
(
obj
.
replicas
.
contains
(
Integer
.
valueOf
(-
1
))
&&
AsyncMulticastQueue
.
stage
(
obj
))
localFile
=
obj
.
getLocalFile
(
false
);
if
(
localFile
==
null
)
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
,
"The file cannot be served by this server directly, the physical copy is not on this machine"
);
return
;
}
}
}
if
(
range
==
null
||
range
.
trim
().
isEmpty
())
{
if
(
range
==
null
||
range
.
trim
().
isEmpty
())
{
...
@@ -280,7 +286,9 @@ public class SQLDownload extends HttpServlet {
...
@@ -280,7 +286,9 @@ public class SQLDownload extends HttpServlet {
response
.
setContentLengthLong
(
contentLength
);
response
.
setContentLengthLong
(
contentLength
);
try
(
RandomAccessFile
input
=
new
RandomAccessFile
(
localFile
,
"r"
);
OutputStream
output
=
response
.
getOutputStream
())
{
try
(
RandomAccessFile
input
=
new
RandomAccessFile
(
localFile
,
"r"
);
OutputStream
output
=
response
.
getOutputStream
())
{
final
Iterator
<
Map
.
Entry
<
Long
,
Long
>>
itRange
=
requestedRanges
.
iterator
();
final
Iterator
<
Map
.
Entry
<
Long
,
Long
>>
itRange
=
requestedRanges
.
iterator
();
final
Iterator
<
String
>
itSubHeader
=
subHeaders
.
iterator
();
final
Iterator
<
String
>
itSubHeader
=
subHeaders
.
iterator
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment