Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
dCache
cta
Commits
10b0fbe0
Commit
10b0fbe0
authored
12 years ago
by
Andrea Ieri
Browse files
Options
Downloads
Patches
Plain Diff
bug #98491: RFE: GCD should demand Cns_bulkexist to the headnode
Cns_bulkexist moved to the stager. Coding by Giuseppe.
parent
87b60f3a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
castor/gc/GcDaemon.cpp
+0
-1
0 additions, 1 deletion
castor/gc/GcDaemon.cpp
castor/gc/SynchronizationThread.cpp
+6
-70
6 additions, 70 deletions
castor/gc/SynchronizationThread.cpp
castor/stager/daemon/GcSvcThread.cpp
+32
-8
32 additions, 8 deletions
castor/stager/daemon/GcSvcThread.cpp
with
38 additions
and
79 deletions
castor/gc/GcDaemon.cpp
+
0
−
1
View file @
10b0fbe0
...
...
@@ -151,7 +151,6 @@ castor::gc::GcDaemon::GcDaemon(): castor::server::BaseDaemon("gcd") {
{
39
,
"Ignoring filename that does not conform to castor naming conventions"
},
{
40
,
"Unexpected exception caught in synchronizeFiles"
},
{
41
,
"Failed to stat file"
},
{
42
,
"File scheduled for deletion as the file no longer exists in the nameserver but still exists in the stager"
},
{
43
,
"Could not get fileid from filepath, giving up for this file"
},
{
-
1
,
""
}};
dlfInit
(
messages
);
...
...
This diff is collapsed.
Click to expand it.
castor/gc/SynchronizationThread.cpp
+
6
−
70
View file @
10b0fbe0
...
...
@@ -647,66 +647,28 @@ void castor::gc::SynchronizationThread::synchronizeFiles
}
// Create an array of 64bit unsigned integers to pass to the Cns_bulkexist
// call
u_signed64
*
cnsFileIds
=
(
u_signed64
*
)
calloc
(
filePaths
.
size
(),
sizeof
(
u_signed64
));
if
(
cnsFileIds
==
0
){
// "Memory allocation failure"
castor
::
dlf
::
Param
params
[]
=
{
castor
::
dlf
::
Param
(
"Function"
,
"synchronizeFiles"
),
castor
::
dlf
::
Param
(
"Message"
,
strerror
(
errno
))
};
castor
::
dlf
::
dlf_writep
(
nullCuuid
,
DLF_LVL_SYSTEM
,
29
,
2
,
params
);
return
;
}
// Populate the array with fileids
int
i
=
0
;
// Populate the vector and the map with fileids and their corresponding physical paths
std
::
map
<
u_signed64
,
std
::
string
>
cnsFilePaths
;
std
::
vector
<
u_signed64
>
fileIds
;
for
(
std
::
map
<
u_signed64
,
std
::
string
>::
iterator
it
=
filePaths
.
begin
();
it
!=
filePaths
.
end
();
it
++
,
i
++
)
{
it
++
)
{
try
{
u_signed64
fid
=
fileIdFromFilePath
(
it
->
second
);
cnsFilePaths
[
fid
]
=
it
->
second
;
cnsF
ileIds
[
i
]
=
fid
;
f
ileIds
.
push_back
(
fid
)
;
}
catch
(
castor
::
exception
::
Exception
&
e
)
{
// "Could not get fileid from filepath, giving up for this file"
castor
::
dlf
::
Param
params
[]
=
{
castor
::
dlf
::
Param
(
"Filename"
,
it
->
second
),
castor
::
dlf
::
Param
(
"Error"
,
e
.
code
()),
castor
::
dlf
::
Param
(
"ErrorMessage"
,
e
.
getMessage
().
str
())};
castor
::
dlf
::
dlf_writep
(
nullCuuid
,
DLF_LVL_ERROR
,
43
,
3
,
params
,
&
fileId
);
castor
::
dlf
::
dlf_writep
(
nullCuuid
,
DLF_LVL_ERROR
,
43
,
3
,
params
,
&
fileId
);
}
}
// Call the nameserver to determine which files have been deleted
int
nbFids
=
cnsFilePaths
.
size
();
int
rc
=
Cns_bulkexist
(
nameServer
.
c_str
(),
cnsFileIds
,
&
nbFids
);
if
(
rc
!=
0
)
{
// "Error calling nameserver function Cns_bulkexist"
castor
::
dlf
::
Param
params
[]
=
{
castor
::
dlf
::
Param
(
"Nameserver"
,
nameServer
),
castor
::
dlf
::
Param
(
"Message"
,
sstrerror
(
serrno
))};
castor
::
dlf
::
dlf_writep
(
nullCuuid
,
DLF_LVL_ERROR
,
32
,
2
,
params
);
free
(
cnsFileIds
);
return
;
}
// No files to be deleted
if
(
nbFids
==
0
)
{
free
(
cnsFileIds
);
return
;
}
// Put the returned deleted files into a vector
std
::
vector
<
u_signed64
>
delFileIds
;
for
(
i
=
0
;
i
<
nbFids
;
i
++
)
{
delFileIds
.
push_back
(
cnsFileIds
[
i
]);
}
free
(
cnsFileIds
);
// Notify the stager to the deletion of the orphaned files
orphans
=
gcSvc
->
nsFilesDeleted
(
delF
ileIds
,
nameServer
);
orphans
=
gcSvc
->
nsFilesDeleted
(
f
ileIds
,
nameServer
);
// Remove orphaned files
spaceFreed
=
0
,
nbOrphanFiles
=
0
;
...
...
@@ -755,30 +717,4 @@ void castor::gc::SynchronizationThread::synchronizeFiles
castor
::
dlf
::
dlf_writep
(
nullCuuid
,
DLF_LVL_SYSTEM
,
35
,
2
,
params
);
}
// List all files that will be scheduled for later deletion using the normal
// selectFile2Delete logic
for
(
std
::
vector
<
u_signed64
>::
const_iterator
it
=
delFileIds
.
begin
();
it
!=
delFileIds
.
end
();
it
++
)
{
// Exclude those files which we already removed above i.e. those which
// aren't in the stager catalogue
std
::
vector
<
u_signed64
>::
const_iterator
it2
=
std
::
find
(
orphans
.
begin
(),
orphans
.
end
(),
*
it
);
if
(
it2
!=
orphans
.
end
())
{
continue
;
}
try
{
fileId
.
fileid
=
fileIdFromFilePath
(
cnsFilePaths
.
find
(
*
it
)
->
second
);
}
catch
(
castor
::
exception
::
Exception
&
e
)
{
// fileid won't be set but this only impacts logging, so let it go
}
// "File scheduled for deletion as the file no longer exists in the
// nameserver but still exists in the stager"
castor
::
dlf
::
Param
params
[]
=
{
castor
::
dlf
::
Param
(
"Filename"
,
cnsFilePaths
.
find
(
*
it
)
->
second
)};
castor
::
dlf
::
dlf_writep
(
nullCuuid
,
DLF_LVL_SYSTEM
,
42
,
1
,
params
,
&
fileId
);
}
}
This diff is collapsed.
Click to expand it.
castor/stager/daemon/GcSvcThread.cpp
+
32
−
8
View file @
10b0fbe0
...
...
@@ -209,6 +209,7 @@ void castor::stager::daemon::GcSvcThread::handleNsFilesDeleted
// Useful Variables
castor
::
stager
::
NsFilesDeleted
*
uReq
;
std
::
vector
<
u_signed64
>
result
;
std
::
vector
<
u_signed64
>
delFileIds
;
castor
::
stager
::
NsFilesDeletedResponse
res
;
try
{
// get the NsFilesDeleted request
...
...
@@ -217,20 +218,41 @@ void castor::stager::daemon::GcSvcThread::handleNsFilesDeleted
// Fills it with files to be deleted
svcs
->
fillObj
(
&
ad
,
req
,
castor
::
OBJ_GCFile
);
// collect input fileids
std
::
vector
<
u_signed64
>
input
;
u_signed64
*
input
=
(
u_signed64
*
)
calloc
(
uReq
->
files
().
size
(),
sizeof
(
u_signed64
));
int
i
=
0
;
for
(
std
::
vector
<
castor
::
stager
::
GCFile
*>::
const_iterator
it
=
uReq
->
files
().
begin
();
it
!=
uReq
->
files
().
end
();
it
++
)
{
it
++
,
i
++
)
{
// despite the syntax, this IS a fileId.
// Some bad reuse of exiting object, I apologize...
input
.
push_back
((
*
it
)
->
diskCopyId
());
input
[
i
]
=
(
*
it
)
->
diskCopyId
();
}
// Call the nameserver to determine which files have been deleted
int
nbFids
=
uReq
->
files
().
size
();
int
rc
=
Cns_bulkexist
(
uReq
->
nsHost
().
c_str
(),
input
,
&
nbFids
);
if
(
rc
!=
0
)
{
free
(
input
);
castor
::
exception
::
Exception
e
(
serrno
);
e
.
getMessage
()
<<
strerror
(
serrno
);
throw
e
;
}
// Put the returned deleted files into a vector
for
(
i
=
0
;
i
<
nbFids
;
i
++
)
{
delFileIds
.
push_back
(
input
[
i
]);
}
free
(
input
);
// only if some files are to be deleted
if
(
nbFids
>
0
)
{
// "Invoking nsFilesDeleted"
castor
::
dlf
::
Param
params
[]
=
{
castor
::
dlf
::
Param
(
"NbFiles"
,
uReq
->
files
().
size
())};
castor
::
dlf
::
dlf_writep
(
uuid
,
DLF_LVL_SYSTEM
,
STAGER_GCSVC_NSFILDEL
,
1
,
params
);
result
=
gcSvc
->
nsFilesDeleted
(
delFileIds
,
uReq
->
nsHost
());
}
// "Invoking nsFilesDeleted"
castor
::
dlf
::
Param
params
[]
=
{
castor
::
dlf
::
Param
(
"NbFiles"
,
uReq
->
files
().
size
())};
castor
::
dlf
::
dlf_writep
(
uuid
,
DLF_LVL_SYSTEM
,
STAGER_GCSVC_NSFILDEL
,
1
,
params
);
result
=
gcSvc
->
nsFilesDeleted
(
input
,
uReq
->
nsHost
());
}
catch
(
castor
::
exception
::
Exception
&
e
)
{
// "Unexpected exception caught"
castor
::
dlf
::
Param
params
[]
=
...
...
@@ -241,6 +263,8 @@ void castor::stager::daemon::GcSvcThread::handleNsFilesDeleted
res
.
setErrorCode
(
e
.
code
());
res
.
setErrorMessage
(
e
.
getMessage
().
str
());
}
// Prepare reply to gcd and log
Cns_fileid
fileId
;
strncpy
(
fileId
.
server
,
uReq
->
nsHost
().
c_str
(),
CA_MAXHOSTNAMELEN
+
1
);
fileId
.
server
[
CA_MAXHOSTNAMELEN
]
=
0
;
...
...
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