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
2f692d74
Commit
2f692d74
authored
Sep 10, 2014
by
Eric Cano
Browse files
Renamed the _this variables to more meaningful names.
parent
e616b05d
Changes
3
Hide whitespace changes
Inline
Side-by-side
castor/tape/tapeserver/daemon/MigrationReportPacker.cpp
View file @
2f692d74
...
...
@@ -103,7 +103,7 @@ void MigrationReportPacker::reportStuckOn(FileStruct& file){
//------------------------------------------------------------------------------
//ReportSuccessful::execute
//------------------------------------------------------------------------------
void
MigrationReportPacker
::
ReportSuccessful
::
execute
(
MigrationReportPacker
&
_this
){
void
MigrationReportPacker
::
ReportSuccessful
::
execute
(
MigrationReportPacker
&
reportPacker
){
std
::
auto_ptr
<
tapegateway
::
FileMigratedNotificationStruct
>
successMigration
(
new
tapegateway
::
FileMigratedNotificationStruct
);
successMigration
->
setFseq
(
m_migratedFile
.
fseq
());
successMigration
->
setFileTransactionId
(
m_migratedFile
.
fileTransactionId
());
...
...
@@ -125,7 +125,7 @@ void MigrationReportPacker::ReportSuccessful::execute(MigrationReportPacker& _th
// successMigration->setBlockId2();
// successMigration->setBlockId3();
_this
.
m_listReports
->
addSuccessfulMigrations
(
successMigration
.
release
());
reportPacker
.
m_listReports
->
addSuccessfulMigrations
(
successMigration
.
release
());
}
//------------------------------------------------------------------------------
//ReportFlush::computeCompressedSize
...
...
@@ -162,115 +162,115 @@ std::vector<tapegateway::FileMigratedNotificationStruct*>::iterator end
//------------------------------------------------------------------------------
//Report::reportFileErrors
//------------------------------------------------------------------------------
void
MigrationReportPacker
::
Report
::
reportFileErrors
(
MigrationReportPacker
&
_this
)
void
MigrationReportPacker
::
Report
::
reportFileErrors
(
MigrationReportPacker
&
reportPacker
)
{
// Some errors still have to be transmitted to the client, but not the
// successful writes which were not validated by a flush (they will be
// discarded)
if
(
_this
.
m_listReports
->
failedMigrations
().
size
())
{
if
(
reportPacker
.
m_listReports
->
failedMigrations
().
size
())
{
tapeserver
::
client
::
ClientInterface
::
RequestReport
chrono
;
// First, cleanup the report of existing successes
for
(
size_t
i
=
0
;
i
<
_this
.
m_listReports
->
successfulMigrations
().
size
();
i
++
)
{
delete
_this
.
m_listReports
->
successfulMigrations
()[
i
];
for
(
size_t
i
=
0
;
i
<
reportPacker
.
m_listReports
->
successfulMigrations
().
size
();
i
++
)
{
delete
reportPacker
.
m_listReports
->
successfulMigrations
()[
i
];
}
_this
.
m_listReports
->
successfulMigrations
().
resize
(
0
);
reportPacker
.
m_listReports
->
successfulMigrations
().
resize
(
0
);
// Report those errors to the client
_this
.
logReportWithError
(
_this
.
m_listReports
->
failedMigrations
(),
reportPacker
.
logReportWithError
(
reportPacker
.
m_listReports
->
failedMigrations
(),
"Will report failed file to the client before end of session"
);
_this
.
m_client
.
reportMigrationResults
(
*
(
_this
.
m_listReports
),
chrono
);
log
::
ScopedParamContainer
sp
(
_this
.
m_lc
);
reportPacker
.
m_client
.
reportMigrationResults
(
*
(
reportPacker
.
m_listReports
),
chrono
);
log
::
ScopedParamContainer
sp
(
reportPacker
.
m_lc
);
sp
.
add
(
"connectDuration"
,
chrono
.
connectDuration
)
.
add
(
"sendRecvDuration"
,
chrono
.
sendRecvDuration
)
.
add
(
"transactionId"
,
chrono
.
transactionId
);
_this
.
m_lc
.
log
(
LOG_INFO
,
"Reported failed file(s) to the client before end of session"
);
reportPacker
.
m_lc
.
log
(
LOG_INFO
,
"Reported failed file(s) to the client before end of session"
);
// Reset the report lists.
_this
.
m_listReports
.
reset
(
new
tapegateway
::
FileMigrationReportList
);
reportPacker
.
m_listReports
.
reset
(
new
tapegateway
::
FileMigrationReportList
);
}
}
//------------------------------------------------------------------------------
//ReportFlush::execute
//------------------------------------------------------------------------------
void
MigrationReportPacker
::
ReportFlush
::
execute
(
MigrationReportPacker
&
_this
){
void
MigrationReportPacker
::
ReportFlush
::
execute
(
MigrationReportPacker
&
reportPacker
){
if
(
!
_this
.
m_errorHappened
){
if
(
!
reportPacker
.
m_errorHappened
){
tapeserver
::
client
::
ClientInterface
::
RequestReport
chrono
;
try
{
computeCompressedSize
(
_this
.
m_listReports
->
successfulMigrations
().
begin
(),
_this
.
m_listReports
->
successfulMigrations
().
end
());
_this
.
m_client
.
reportMigrationResults
(
*
(
_this
.
m_listReports
),
chrono
);
_this
.
logReport
(
_this
.
m_listReports
->
successfulMigrations
(),
"A file was successfully written on the tape"
);
log
::
ScopedParamContainer
container
(
_this
.
m_lc
);
container
.
add
(
"batch size"
,
_this
.
m_listReports
->
successfulMigrations
().
size
())
computeCompressedSize
(
reportPacker
.
m_listReports
->
successfulMigrations
().
begin
(),
reportPacker
.
m_listReports
->
successfulMigrations
().
end
());
reportPacker
.
m_client
.
reportMigrationResults
(
*
(
reportPacker
.
m_listReports
),
chrono
);
reportPacker
.
logReport
(
reportPacker
.
m_listReports
->
successfulMigrations
(),
"A file was successfully written on the tape"
);
log
::
ScopedParamContainer
container
(
reportPacker
.
m_lc
);
container
.
add
(
"batch size"
,
reportPacker
.
m_listReports
->
successfulMigrations
().
size
())
.
add
(
"compressed"
,
m_compressStats
.
toTape
)
.
add
(
"Non compressed"
,
m_compressStats
.
fromHost
);
_this
.
m_lc
.
log
(
LOG_INFO
,
"Reported to the client that a batch of file was written on tape"
);
reportPacker
.
m_lc
.
log
(
LOG_INFO
,
"Reported to the client that a batch of file was written on tape"
);
}
catch
(
const
castor
::
exception
::
Exception
&
e
){
LogContext
::
ScopedParam
sp
[]
=
{
LogContext
::
ScopedParam
(
_this
.
m_lc
,
Param
(
"exceptionCode"
,
e
.
code
())),
LogContext
::
ScopedParam
(
_this
.
m_lc
,
Param
(
"exceptionMessageValue"
,
e
.
getMessageValue
())),
LogContext
::
ScopedParam
(
_this
.
m_lc
,
Param
(
"exceptionWhat"
,
e
.
what
()))
LogContext
::
ScopedParam
(
reportPacker
.
m_lc
,
Param
(
"exceptionCode"
,
e
.
code
())),
LogContext
::
ScopedParam
(
reportPacker
.
m_lc
,
Param
(
"exceptionMessageValue"
,
e
.
getMessageValue
())),
LogContext
::
ScopedParam
(
reportPacker
.
m_lc
,
Param
(
"exceptionWhat"
,
e
.
what
()))
};
tape
::
utils
::
suppresUnusedVariable
(
sp
);
const
std
::
string
msg_error
=
"An exception was caught trying to call reportMigrationResults"
;
_this
.
m_lc
.
log
(
LOG_ERR
,
msg_error
);
reportPacker
.
m_lc
.
log
(
LOG_ERR
,
msg_error
);
throw
failedMigrationRecallResult
(
msg_error
);
}
}
else
{
// This is an abnormal situation: we should never flush after an error!
_this
.
m_lc
.
log
(
LOG_ALERT
,
"Received a flush after an error: sending file errors to client"
);
reportFileErrors
(
_this
);
reportPacker
.
m_lc
.
log
(
LOG_ALERT
,
"Received a flush after an error: sending file errors to client"
);
reportFileErrors
(
reportPacker
);
}
//reset (ie delete and replace) the current m_listReports.
//Thus all current reports are deleted otherwise they would have been sent again at the next flush
_this
.
m_listReports
.
reset
(
new
tapegateway
::
FileMigrationReportList
);
reportPacker
.
m_listReports
.
reset
(
new
tapegateway
::
FileMigrationReportList
);
}
//------------------------------------------------------------------------------
//ReportEndofSession::execute
//------------------------------------------------------------------------------
void
MigrationReportPacker
::
ReportEndofSession
::
execute
(
MigrationReportPacker
&
_this
){
void
MigrationReportPacker
::
ReportEndofSession
::
execute
(
MigrationReportPacker
&
reportPacker
){
client
::
ClientInterface
::
RequestReport
chrono
;
if
(
!
_this
.
m_errorHappened
){
_this
.
m_client
.
reportEndOfSession
(
chrono
);
log
::
ScopedParamContainer
sp
(
_this
.
m_lc
);
if
(
!
reportPacker
.
m_errorHappened
){
reportPacker
.
m_client
.
reportEndOfSession
(
chrono
);
log
::
ScopedParamContainer
sp
(
reportPacker
.
m_lc
);
sp
.
add
(
"connectDuration"
,
chrono
.
connectDuration
)
.
add
(
"sendRecvDuration"
,
chrono
.
sendRecvDuration
)
.
add
(
"transactionId"
,
chrono
.
transactionId
);
_this
.
m_lc
.
log
(
LOG_INFO
,
"Reported end of session to client"
);
reportPacker
.
m_lc
.
log
(
LOG_INFO
,
"Reported end of session to client"
);
}
else
{
reportFileErrors
(
_this
);
reportFileErrors
(
reportPacker
);
// We have some errors: report end of session as such to the client
_this
.
m_client
.
reportEndOfSessionWithError
(
"Previous file errors"
,
SEINTERNAL
,
chrono
);
log
::
ScopedParamContainer
sp
(
_this
.
m_lc
);
reportPacker
.
m_client
.
reportEndOfSessionWithError
(
"Previous file errors"
,
SEINTERNAL
,
chrono
);
log
::
ScopedParamContainer
sp
(
reportPacker
.
m_lc
);
sp
.
add
(
"errorMessage"
,
"Previous file errors"
)
.
add
(
"errorCode"
,
SEINTERNAL
)
.
add
(
"connectDuration"
,
chrono
.
connectDuration
)
.
add
(
"sendRecvDuration"
,
chrono
.
sendRecvDuration
)
.
add
(
"transactionId"
,
chrono
.
transactionId
);
_this
.
m_lc
.
log
(
LOG_ERR
,
"Reported end of session with error to client due to previous file errors"
);
reportPacker
.
m_lc
.
log
(
LOG_ERR
,
"Reported end of session with error to client due to previous file errors"
);
}
_this
.
m_continue
=
false
;
reportPacker
.
m_continue
=
false
;
}
//------------------------------------------------------------------------------
//ReportEndofSessionWithErrors::execute
//------------------------------------------------------------------------------
void
MigrationReportPacker
::
ReportEndofSessionWithErrors
::
execute
(
MigrationReportPacker
&
_this
){
void
MigrationReportPacker
::
ReportEndofSessionWithErrors
::
execute
(
MigrationReportPacker
&
reportPacker
){
client
::
ClientInterface
::
RequestReport
chrono
;
if
(
_this
.
m_errorHappened
)
{
reportFileErrors
(
_this
);
_this
.
m_client
.
reportEndOfSessionWithError
(
m_message
,
m_errorCode
,
chrono
);
log
::
ScopedParamContainer
sp
(
_this
.
m_lc
);
if
(
reportPacker
.
m_errorHappened
)
{
reportFileErrors
(
reportPacker
);
reportPacker
.
m_client
.
reportEndOfSessionWithError
(
m_message
,
m_errorCode
,
chrono
);
log
::
ScopedParamContainer
sp
(
reportPacker
.
m_lc
);
sp
.
add
(
"errorMessage"
,
m_message
)
.
add
(
"errorCode"
,
m_errorCode
)
.
add
(
"connectDuration"
,
chrono
.
connectDuration
)
.
add
(
"sendRecvDuration"
,
chrono
.
sendRecvDuration
)
.
add
(
"transactionId"
,
chrono
.
transactionId
);
_this
.
m_lc
.
log
(
LOG_INFO
,
"Reported end of session with error to client after sending file errors"
);
reportPacker
.
m_lc
.
log
(
LOG_INFO
,
"Reported end of session with error to client after sending file errors"
);
}
else
{
const
std
::
string
&
msg
=
"Reported end of session with error to client"
;
// As a measure of safety we censor any session error which is not ENOSPC into
...
...
@@ -278,18 +278,18 @@ void MigrationReportPacker::ReportEndofSessionWithErrors::execute(MigrationRepor
if
(
ENOSPC
!=
m_errorCode
)
{
m_errorCode
=
SEINTERNAL
;
}
_this
.
m_client
.
reportEndOfSessionWithError
(
msg
,
m_errorCode
,
chrono
);
_this
.
m_lc
.
log
(
LOG_INFO
,
msg
);
reportPacker
.
m_client
.
reportEndOfSessionWithError
(
msg
,
m_errorCode
,
chrono
);
reportPacker
.
m_lc
.
log
(
LOG_INFO
,
msg
);
}
_this
.
m_continue
=
false
;
reportPacker
.
m_continue
=
false
;
}
//------------------------------------------------------------------------------
//ReportError::execute
//------------------------------------------------------------------------------
void
MigrationReportPacker
::
ReportError
::
execute
(
MigrationReportPacker
&
_this
){
void
MigrationReportPacker
::
ReportError
::
execute
(
MigrationReportPacker
&
reportPacker
){
std
::
auto_ptr
<
tapegateway
::
FileErrorReportStruct
>
failedMigration
(
new
tapegateway
::
FileErrorReportStruct
);
//failedMigration->setFileMigrationReportList(
_this
.m_listReports.get());
//failedMigration->setFileMigrationReportList(
reportPacker
.m_listReports.get());
failedMigration
->
setErrorCode
(
m_error_code
);
failedMigration
->
setErrorMessage
(
m_error_msg
);
failedMigration
->
setFseq
(
m_migratedFile
.
fseq
());
...
...
@@ -297,8 +297,8 @@ void MigrationReportPacker::ReportError::execute(MigrationReportPacker& _this){
failedMigration
->
setId
(
m_migratedFile
.
id
());
failedMigration
->
setNshost
(
m_migratedFile
.
nshost
());
_this
.
m_listReports
->
addFailedMigrations
(
failedMigration
.
release
());
_this
.
m_errorHappened
=
true
;
reportPacker
.
m_listReports
->
addFailedMigrations
(
failedMigration
.
release
());
reportPacker
.
m_errorHappened
=
true
;
}
//------------------------------------------------------------------------------
...
...
castor/tape/tapeserver/daemon/MigrationReportPacker.hpp
View file @
2f692d74
...
...
@@ -108,7 +108,7 @@ private:
* recorded, we will transmit it to the client before signaling the
* end of the session.
*/
virtual
void
reportFileErrors
(
MigrationReportPacker
&
_this
);
virtual
void
reportFileErrors
(
MigrationReportPacker
&
reportPacker
);
};
class
ReportSuccessful
:
public
Report
{
const
FileStruct
m_migratedFile
;
...
...
@@ -118,7 +118,7 @@ private:
ReportSuccessful
(
const
FileStruct
&
file
,
unsigned
long
checksum
,
u_int32_t
blockId
)
:
m_migratedFile
(
file
),
m_checksum
(
checksum
),
m_blockId
(
blockId
){}
virtual
void
execute
(
MigrationReportPacker
&
_this
);
virtual
void
execute
(
MigrationReportPacker
&
reportPacker
);
};
class
ReportFlush
:
public
Report
{
drives
::
compressionStats
m_compressStats
;
...
...
@@ -145,7 +145,7 @@ private:
* */
ReportFlush
(
drives
::
compressionStats
compressStats
)
:
m_compressStats
(
compressStats
){}
void
execute
(
MigrationReportPacker
&
_this
);
void
execute
(
MigrationReportPacker
&
reportPacker
);
};
class
ReportError
:
public
Report
{
const
FileStruct
m_migratedFile
;
...
...
@@ -155,11 +155,11 @@ private:
ReportError
(
const
FileStruct
&
file
,
std
::
string
msg
,
int
error_code
)
:
m_migratedFile
(
file
),
m_error_msg
(
msg
),
m_error_code
(
error_code
){}
virtual
void
execute
(
MigrationReportPacker
&
_this
);
virtual
void
execute
(
MigrationReportPacker
&
reportPacker
);
};
class
ReportEndofSession
:
public
Report
{
public:
virtual
void
execute
(
MigrationReportPacker
&
_this
);
virtual
void
execute
(
MigrationReportPacker
&
reportPacker
);
};
class
ReportEndofSessionWithErrors
:
public
Report
{
std
::
string
m_message
;
...
...
@@ -168,7 +168,7 @@ private:
ReportEndofSessionWithErrors
(
std
::
string
msg
,
int
errorCode
)
:
m_message
(
msg
),
m_errorCode
(
errorCode
){}
virtual
void
execute
(
MigrationReportPacker
&
_this
);
virtual
void
execute
(
MigrationReportPacker
&
reportPacker
);
};
class
WorkerThread
:
public
castor
::
server
::
Thread
{
...
...
castor/tape/tapeserver/daemon/RecallReportPacker.hpp
View file @
2f692d74
...
...
@@ -107,7 +107,7 @@ private:
ReportSuccessful
(
const
FileStruct
&
file
,
u_int32_t
checksum
,
u_int64_t
size
)
:
Report
(
false
),
m_recalledFile
(
file
),
m_checksum
(
checksum
),
m_size
(
size
){}
virtual
void
execute
(
RecallReportPacker
&
_this
);
virtual
void
execute
(
RecallReportPacker
&
reportPacker
);
};
class
ReportError
:
public
Report
{
const
FileStruct
m_recalledFile
;
...
...
@@ -117,7 +117,7 @@ private:
ReportError
(
const
FileStruct
&
file
,
std
::
string
msg
,
int
error_code
)
:
Report
(
false
),
m_recalledFile
(
file
),
m_error_msg
(
msg
),
m_error_code
(
error_code
){}
virtual
void
execute
(
RecallReportPacker
&
_this
);
virtual
void
execute
(
RecallReportPacker
&
reportPacker
);
};
class
ReportStuck
:
public
Report
{
const
FileStruct
m_recalledFile
;
...
...
@@ -125,13 +125,13 @@ private:
ReportStuck
(
const
FileStruct
&
file
)
:
Report
(
false
),
m_recalledFile
(
file
){}
virtual
void
execute
(
RecallReportPacker
&
_this
);
virtual
void
execute
(
RecallReportPacker
&
reportPacker
);
};
class
ReportEndofSession
:
public
Report
{
public:
ReportEndofSession
()
:
Report
(
true
){}
virtual
void
execute
(
RecallReportPacker
&
_this
);
virtual
void
execute
(
RecallReportPacker
&
reportPacker
);
};
class
ReportEndofSessionWithErrors
:
public
Report
{
std
::
string
m_message
;
...
...
@@ -140,7 +140,7 @@ private:
ReportEndofSessionWithErrors
(
std
::
string
msg
,
int
error_code
)
:
Report
(
true
),
m_message
(
msg
),
m_error_code
(
error_code
){}
virtual
void
execute
(
RecallReportPacker
&
_this
);
virtual
void
execute
(
RecallReportPacker
&
reportPacker
);
};
class
WorkerThread
:
public
castor
::
server
::
Thread
{
...
...
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