Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
816920a7
Commit
816920a7
authored
Aug 20, 2015
by
Daniele Kruse
Browse files
Added an ArchiveFileInfo to Retrieve job and fixed FileTest
parent
0feb5be1
Changes
8
Hide whitespace changes
Inline
Side-by-side
common/archiveNS/TapeCopyInfo.hpp
View file @
816920a7
...
...
@@ -52,7 +52,7 @@ struct TapeCopyInfo {
/**
* The ID of the file
*/
uint64_t
fileId
;
//
uint64_t fileId;
/**
* The volume identifier of the tape.
...
...
scheduler/RetrieveJob.hpp
View file @
816920a7
...
...
@@ -18,6 +18,7 @@
#pragma once
#include
"common/archiveNS/ArchiveFileInfo.hpp"
#include
"common/archiveNS/TapeCopyInfo.hpp"
#include
"common/remoteFS/RemotePath.hpp"
...
...
@@ -122,7 +123,7 @@ public:
PositioningMethod
positioningMethod
;
/**< The desired positioning method. */
RemotePath
remoteFilePath
;
/** <The location of the destination file. */
std
::
string
m_id
;
uint64_t
m_fileSiz
e
;
ArchiveFileInfo
archiveFil
e
;
};
// struct RetrieveJob
}
// namespace cta
scheduler/SchedulerDatabaseTest.cpp
View file @
816920a7
...
...
@@ -475,7 +475,6 @@ TEST_P(SchedulerDatabaseTest, getMountInfo) {
std
::
list
<
TapeCopyInfo
>
tcl
;
tcl
.
push_back
(
TapeCopyInfo
());
tcl
.
back
().
blockId
=
666
;
tcl
.
back
().
fileId
=
777
;
tcl
.
back
().
archiveFilePath
=
"cta:://cta/myfile"
;
tcl
.
back
().
fSeq
=
10
;
tcl
.
back
().
nsHostName
=
"NSHost"
;
...
...
@@ -483,7 +482,6 @@ TEST_P(SchedulerDatabaseTest, getMountInfo) {
tcl
.
back
().
copyNumber
=
1
;
tcl
.
push_back
(
TapeCopyInfo
());
tcl
.
back
().
blockId
=
111
;
tcl
.
back
().
fileId
=
777
;
tcl
.
back
().
archiveFilePath
=
"cta:://cta/myfile"
;
tcl
.
back
().
fSeq
=
5
;
tcl
.
back
().
nsHostName
=
"NSHost"
;
...
...
@@ -524,7 +522,6 @@ TEST_P(SchedulerDatabaseTest, getMountInfo) {
std
::
list
<
TapeCopyInfo
>
tcl2
;
tcl2
.
push_back
(
TapeCopyInfo
());
tcl2
.
back
().
blockId
=
999
;
tcl2
.
back
().
fileId
=
888
;
tcl2
.
back
().
archiveFilePath
=
"cta:://cta/myfile2"
;
tcl2
.
back
().
fSeq
=
11
;
tcl2
.
back
().
nsHostName
=
"NSHost"
;
...
...
@@ -532,7 +529,6 @@ TEST_P(SchedulerDatabaseTest, getMountInfo) {
tcl2
.
back
().
copyNumber
=
1
;
tcl2
.
push_back
(
TapeCopyInfo
());
tcl2
.
back
().
blockId
=
333
;
tcl2
.
back
().
fileId
=
888
;
tcl2
.
back
().
archiveFilePath
=
"cta:://cta/myfile2"
;
tcl2
.
back
().
fSeq
=
3
;
tcl2
.
back
().
nsHostName
=
"NSHost"
;
...
...
tapeserver/castor/tape/tapeserver/daemon/DiskWriteTask.cpp
View file @
816920a7
...
...
@@ -52,7 +52,7 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc,
castor
::
utils
::
Timer
totalTime
(
localTime
);
castor
::
utils
::
Timer
transferTime
(
localTime
);
log
::
ScopedParamContainer
URLcontext
(
lc
);
URLcontext
.
add
(
"NSFILEID"
,
m_retrieveJob
->
tapeCopy
.
fileId
)
URLcontext
.
add
(
"NSFILEID"
,
m_retrieveJob
->
archiveFile
.
fileId
)
.
add
(
"path"
,
m_retrieveJob
->
tapeCopy
.
archiveFilePath
)
.
add
(
"fileTransactionId"
,
m_retrieveJob
->
m_id
)
.
add
(
"fSeq"
,
m_retrieveJob
->
tapeCopy
.
fSeq
);
...
...
@@ -200,7 +200,7 @@ void DiskWriteTask::releaseAllBlock(){
//------------------------------------------------------------------------------
void
DiskWriteTask
::
checkErrors
(
MemBlock
*
mb
,
int
blockId
,
castor
::
log
::
LogContext
&
lc
){
using
namespace
castor
::
log
;
if
(
m_retrieveJob
->
tapeCopy
.
fileId
!=
static_cast
<
unsigned
int
>
(
mb
->
m_fileid
)
if
(
m_retrieveJob
->
archiveFile
.
fileId
!=
static_cast
<
unsigned
int
>
(
mb
->
m_fileid
)
||
blockId
!=
mb
->
m_fileBlock
||
mb
->
isFailed
()
){
LogContext
::
ScopedParam
sp
[]
=
{
LogContext
::
ScopedParam
(
lc
,
Param
(
"received_NSFILEID"
,
mb
->
m_fileid
)),
...
...
@@ -253,7 +253,7 @@ void DiskWriteTask::logWithStat(int level,const std::string& msg,log::LogContext
m_stats
.
transferTime
?
1.0
*
m_stats
.
dataVolume
/
1000
/
1000
/
m_stats
.
transferTime
:
0
)
.
add
(
"openRWCloseToTransferTimeRatio"
,
m_stats
.
transferTime
?
(
m_stats
.
openingTime
+
m_stats
.
readWriteTime
+
m_stats
.
closingTime
)
/
m_stats
.
transferTime
:
0.0
)
.
add
(
"FILEID"
,
m_retrieveJob
->
tapeCopy
.
fileId
)
.
add
(
"FILEID"
,
m_retrieveJob
->
archiveFile
.
fileId
)
.
add
(
"path"
,
m_retrieveJob
->
tapeCopy
.
archiveFilePath
);
lc
.
log
(
level
,
msg
);
}
...
...
tapeserver/castor/tape/tapeserver/daemon/RecallTaskInjector.cpp
View file @
816920a7
...
...
@@ -92,7 +92,7 @@ void RecallTaskInjector::injectBulkRecalls(const std::vector<cta::RetrieveJob *>
LogContext
::
ScopedParam
sp
[]
=
{
LogContext
::
ScopedParam
(
m_lc
,
Param
(
"NSHOSTNAME"
,
(
*
it
)
->
tapeCopy
.
nsHostName
)),
LogContext
::
ScopedParam
(
m_lc
,
Param
(
"NSFILEID"
,
(
*
it
)
->
tapeCopy
.
fileId
)),
LogContext
::
ScopedParam
(
m_lc
,
Param
(
"NSFILEID"
,
(
*
it
)
->
archiveFile
.
fileId
)),
LogContext
::
ScopedParam
(
m_lc
,
Param
(
"fSeq"
,
(
*
it
)
->
tapeCopy
.
fSeq
)),
LogContext
::
ScopedParam
(
m_lc
,
Param
(
"blockID"
,
(
*
it
)
->
tapeCopy
.
blockId
)),
LogContext
::
ScopedParam
(
m_lc
,
Param
(
"path"
,
(
*
it
)
->
tapeCopy
.
archiveFilePath
))
...
...
@@ -126,7 +126,7 @@ bool RecallTaskInjector::synchronousInjection()
if
(
!
job
.
get
())
break
;
jobs
.
push_back
(
job
.
release
());
files
++
;
bytes
+=
job
->
m_f
ile
S
ize
;
bytes
+=
job
->
archiveF
ile
.
s
ize
;
}
}
catch
(
castor
::
exception
::
Exception
&
ex
)
{
castor
::
log
::
ScopedParamContainer
scoped
(
m_lc
);
...
...
@@ -194,7 +194,7 @@ void RecallTaskInjector::WorkerThread::run()
if
(
!
job
.
get
())
break
;
jobs
.
push_back
(
job
.
release
());
files
++
;
bytes
+=
job
->
m_f
ile
S
ize
;
bytes
+=
job
->
archiveF
ile
.
s
ize
;
}
LogContext
::
ScopedParam
sp01
(
m_parent
.
m_lc
,
Param
(
"transactionId"
,
m_parent
.
m_retrieveMount
.
getMountTransactionId
()));
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeReadTask.hpp
View file @
816920a7
...
...
@@ -70,7 +70,7 @@ public:
// Set the common context for all the coming logs (file info)
log
::
ScopedParamContainer
params
(
lc
);
params
.
add
(
"NSHOSTNAME"
,
m_retrieveJob
->
tapeCopy
.
nsHostName
)
.
add
(
"NSFILEID"
,
m_retrieveJob
->
tapeCopy
.
fileId
)
.
add
(
"NSFILEID"
,
m_retrieveJob
->
archiveFile
.
fileId
)
.
add
(
"BlockId"
,
m_retrieveJob
->
tapeCopy
.
blockId
)
.
add
(
"fSeq"
,
m_retrieveJob
->
tapeCopy
.
fSeq
)
.
add
(
"fileTransactionId"
,
m_retrieveJob
->
m_id
)
...
...
@@ -112,7 +112,7 @@ public:
mb
->
m_fSeq
=
m_retrieveJob
->
tapeCopy
.
fSeq
;
mb
->
m_fileBlock
=
fileBlock
++
;
mb
->
m_fileid
=
m_retrieveJob
->
tapeCopy
.
fileId
;
mb
->
m_fileid
=
m_retrieveJob
->
archiveFile
.
fileId
;
mb
->
m_tapeFileBlock
=
tapeBlock
;
mb
->
m_tapeBlockSize
=
rf
->
getBlockSize
();
try
{
...
...
@@ -192,7 +192,7 @@ public:
void
reportCancellationToDiskTask
(){
MemBlock
*
mb
=
m_mm
.
getFreeBlock
();
mb
->
m_fSeq
=
m_retrieveJob
->
tapeCopy
.
fSeq
;
mb
->
m_fileid
=
m_retrieveJob
->
tapeCopy
.
fileId
;
mb
->
m_fileid
=
m_retrieveJob
->
archiveFile
.
fileId
;
//mark the block cancelled and push it (plus signal the end)
mb
->
markAsCancelled
();
m_fifo
.
pushDataBlock
(
mb
);
...
...
@@ -209,7 +209,7 @@ private:
if
(
!
mb
)
{
mb
=
m_mm
.
getFreeBlock
();
mb
->
m_fSeq
=
m_retrieveJob
->
tapeCopy
.
fSeq
;
mb
->
m_fileid
=
m_retrieveJob
->
tapeCopy
.
fileId
;
mb
->
m_fileid
=
m_retrieveJob
->
archiveFile
.
fileId
;
}
//mark the block failed and push it (plus signal the end)
mb
->
markAsFailed
(
msg
,
code
);
...
...
tapeserver/castor/tape/tapeserver/file/File.cpp
View file @
816920a7
...
...
@@ -108,13 +108,13 @@ namespace castor {
const
cta
::
RetrieveJob
&
filetoRecall
,
const
tape
::
tapeserver
::
daemon
::
VolumeInfo
&
volInfo
)
{
const
std
::
string
&
volId
=
volInfo
.
vid
;
if
(
!
checkHeaderNumericalField
(
hdr1
.
getFileId
(),
filetoRecall
.
tapeCopy
.
fileId
,
hexadecimal
))
{
if
(
!
checkHeaderNumericalField
(
hdr1
.
getFileId
(),
filetoRecall
.
archiveFile
.
fileId
,
hexadecimal
))
{
// the nsfileid stored in HDR1 as an hexadecimal string . The one in
// filetoRecall is numeric
std
::
stringstream
ex_str
;
ex_str
<<
"[HeaderChecker::checkHDR1] - Invalid fileid detected: (0x)
\"
"
<<
hdr1
.
getFileId
()
<<
"
\"
. Wanted: 0x"
<<
std
::
hex
<<
filetoRecall
.
tapeCopy
.
fileId
<<
std
::
endl
;
<<
filetoRecall
.
archiveFile
.
fileId
<<
std
::
endl
;
throw
TapeFormatError
(
ex_str
.
str
());
}
...
...
tapeserver/castor/tape/tapeserver/file/FileTest.cpp
View file @
816920a7
...
...
@@ -56,14 +56,9 @@ namespace UnitTests {
label
=
"K00001"
;
fileToRecall
.
tapeCopy
.
blockId
=
0
;
fileToRecall
.
tapeCopy
.
fSeq
=
1
;
fileToRecall
.
tapeCopy
.
fileId
=
1
;
// fileInfo.blockId=0;
// fileInfo.checksum=43567;
// fileInfo.fSeq=1;
// fileInfo.nsFileId=1;
// fileInfo.size=500;
fileToRecall
.
archiveFile
.
fileId
=
1
;
fileToMigrate
.
archiveFile
.
size
=
500
;
fileToMigrate
.
tapeCopy
.
fileId
=
1
;
fileToMigrate
.
archiveFile
.
fileId
=
1
;
fileToMigrate
.
tapeCopy
.
fSeq
=
1
;
volInfo
.
vid
=
label
;
//Label
...
...
@@ -94,13 +89,13 @@ namespace UnitTests {
TEST_F
(
castorTapeFileTest
,
throwsWhenUsingSessionTwice
)
{
const
std
::
string
testString
(
"Hello World!"
);
castor
::
tape
::
tapeFile
::
WriteSession
*
ws
;
ws
=
new
castor
::
tape
::
tapeFile
::
WriteSession
(
d
,
volInfo
,
0
,
true
);
ASSERT_NO_THROW
(
ws
=
new
castor
::
tape
::
tapeFile
::
WriteSession
(
d
,
volInfo
,
0
,
true
)
)
;
ASSERT_EQ
(
ws
->
m_compressionEnabled
,
true
);
ASSERT_EQ
(
ws
->
m_vid
.
compare
(
label
),
0
);
ASSERT_EQ
(
ws
->
isCorrupted
(),
false
);
{
std
::
unique_ptr
<
castor
::
tape
::
tapeFile
::
WriteFile
>
wf
;
ASSERT_NO_THROW
(
new
castor
::
tape
::
tapeFile
::
WriteFile
(
ws
,
fileToMigrate
,
block_size
));
ASSERT_NO_THROW
(
wf
.
reset
(
new
castor
::
tape
::
tapeFile
::
WriteFile
(
ws
,
fileToMigrate
,
block_size
))
)
;
wf
->
write
(
testString
.
c_str
(),
testString
.
size
());
wf
->
close
();
}
...
...
@@ -121,7 +116,7 @@ namespace UnitTests {
ASSERT_EQ
(
ws
->
isCorrupted
(),
false
);
{
std
::
unique_ptr
<
castor
::
tape
::
tapeFile
::
WriteFile
>
wf
;
ASSERT_NO_THROW
(
new
castor
::
tape
::
tapeFile
::
WriteFile
(
ws
,
fileToMigrate
,
block_size
));
ASSERT_NO_THROW
(
wf
.
reset
(
new
castor
::
tape
::
tapeFile
::
WriteFile
(
ws
,
fileToMigrate
,
block_size
))
)
;
ASSERT_THROW
(
wf
->
close
(),
castor
::
tape
::
tapeFile
::
ZeroFileWritten
);
}
ASSERT_EQ
(
ws
->
isCorrupted
(),
true
);
...
...
@@ -137,7 +132,7 @@ namespace UnitTests {
ws
=
new
castor
::
tape
::
tapeFile
::
WriteSession
(
d
,
volInfo
,
0
,
true
);
{
std
::
unique_ptr
<
castor
::
tape
::
tapeFile
::
WriteFile
>
wf
;
ASSERT_NO_THROW
(
new
castor
::
tape
::
tapeFile
::
WriteFile
(
ws
,
fileToMigrate
,
block_size
));
ASSERT_NO_THROW
(
wf
.
reset
(
new
castor
::
tape
::
tapeFile
::
WriteFile
(
ws
,
fileToMigrate
,
block_size
))
)
;
wf
->
write
(
testString
.
c_str
(),
testString
.
size
());
wf
->
close
();
ASSERT_THROW
(
wf
->
close
(),
castor
::
tape
::
tapeFile
::
FileClosedTwice
);
...
...
@@ -151,7 +146,7 @@ namespace UnitTests {
ws
=
new
castor
::
tape
::
tapeFile
::
WriteSession
(
d
,
volInfo
,
0
,
true
);
{
std
::
unique_ptr
<
castor
::
tape
::
tapeFile
::
WriteFile
>
wf
;
ASSERT_NO_THROW
(
new
castor
::
tape
::
tapeFile
::
WriteFile
(
ws
,
fileToMigrate
,
block_size
));
ASSERT_NO_THROW
(
wf
.
reset
(
new
castor
::
tape
::
tapeFile
::
WriteFile
(
ws
,
fileToMigrate
,
block_size
))
)
;
wf
->
write
(
testString
.
c_str
(),
testString
.
size
());
wf
->
close
();
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment