Skip to content
Snippets Groups Projects
Commit 435e1933 authored by Daniele Kruse's avatar Daniele Kruse
Browse files

Second partial commit to make the status update mechanism work

parent 880013ba
No related branches found
No related tags found
No related merge requests found
......@@ -189,8 +189,10 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
// end of session
rti.waitThreads();
dwtp.waitThreads();
rrp.waitThread();
rrp.setDiskDone();
trst.waitThreads();
rrp.setTapeDone();
rrp.waitThread();
tsr.waitThreads();
rwd.stopAndWaitThread();
return trst.getHardwareStatus();
......
......@@ -90,7 +90,6 @@ void DiskWriteThreadPool::waitThreads() {
(*i)->wait();
}
m_lc.log(LOG_INFO, "All DiskWriteThreadPool threads are now complete");
m_reporter.setDiskDone();
}
//------------------------------------------------------------------------------
......@@ -181,6 +180,8 @@ void DiskWriteThreadPool::DiskWriteWorkerThread::run() {
logWithStat(LOG_INFO, "Finishing DiskWriteWorkerThread");
m_parentThreadPool.addThreadStats(m_threadStat);
if(0 == --m_parentThreadPool.m_nbActiveThread){
m_parentThreadPool.m_reporter.setDiskDone();
m_parentThreadPool.m_reporter.setTapeDone();
//Im the last Thread alive, report end of session
if(m_parentThreadPool.m_failedWriteCount==0){
......
......@@ -112,6 +112,7 @@ void RecallReportPacker::ReportSuccessful::execute(RecallReportPacker& parent){
void RecallReportPacker::ReportEndofSession::execute(RecallReportPacker& parent){
if(!parent.errorHappened()){
parent.m_retrieveMount->diskComplete();
parent.m_retrieveMount->tapeComplete();
parent.m_lc.log(LOG_INFO,"Nominal RecallReportPacker::EndofSession has been reported");
if (parent.m_watchdog) {
parent.m_watchdog->addParameter(log::Param("status","success"));
......@@ -125,6 +126,7 @@ void RecallReportPacker::ReportEndofSession::execute(RecallReportPacker& parent)
const std::string& msg ="RecallReportPacker::EndofSession has been reported but an error happened somewhere in the process";
parent.m_lc.log(LOG_ERR,msg);
parent.m_retrieveMount->diskComplete();
parent.m_retrieveMount->tapeComplete();
if (parent.m_watchdog) {
parent.m_watchdog->addParameter(log::Param("status","failure"));
// We have a race condition here between the processing of this message by
......@@ -148,13 +150,15 @@ bool RecallReportPacker::ReportEndofSession::goingToEnd(RecallReportPacker& pack
void RecallReportPacker::ReportEndofSessionWithErrors::execute(RecallReportPacker& parent){
if(parent.m_errorHappened) {
parent.m_retrieveMount->diskComplete();
parent.m_retrieveMount->tapeComplete();
LogContext::ScopedParam(parent.m_lc,Param("errorCode",m_error_code));
parent.m_lc.log(LOG_ERR,m_message);
}
else{
const std::string& msg ="RecallReportPacker::EndofSessionWithErrors has been reported but NO error was detected during the process";
parent.m_lc.log(LOG_ERR,msg);
parent.m_retrieveMount->diskComplete();
const std::string& msg ="RecallReportPacker::EndofSessionWithErrors has been reported but NO error was detected during the process";
parent.m_lc.log(LOG_ERR,msg);
parent.m_retrieveMount->diskComplete();
parent.m_retrieveMount->tapeComplete();
}
if (parent.m_watchdog) {
parent.m_watchdog->addParameter(log::Param("status","failure"));
......
......@@ -115,7 +115,6 @@ castor::tape::tapeserver::daemon::TapeReadSingleThread::TapeCleaning::~TapeClean
done:
//then we terminate the global status reporter
m_this.m_initialProcess.finish();
m_this.m_rrp.setTapeDone();
}
//------------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment