Commit 9a05d0a7 authored by Eric Cano's avatar Eric Cano
Browse files

Removed job injector from disk write task to move it to the reader task.

parent 2f444f07
......@@ -33,6 +33,7 @@
#include <memory>
namespace {
// TODO: merge with same function in File.hpp and move to tape/utils
uint32_t blockID(const castor::tape::tapegateway::FileToRecallStruct& ftr)
{
return (ftr.blockId0() << 24) | (ftr.blockId1() << 16) | (ftr.blockId2() << 8) | ftr.blockId3();
......
......@@ -9,7 +9,7 @@ namespace daemon {
DiskWriteThreadPool::DiskWriteThreadPool(int nbThread, int maxFilesReq, int maxBlocksReq,
ReportPackerInterface<detail::Recall>& report,castor::log::LogContext lc):
m_jobInjector(NULL),m_maxFilesReq(maxFilesReq), m_maxBytesReq(maxBlocksReq),
m_maxFilesReq(maxFilesReq), m_maxBytesReq(maxBlocksReq),
m_reporter(report),m_lc(lc)
{
for(int i=0; i<nbThread; i++) {
......@@ -50,9 +50,6 @@ namespace daemon {
m_tasks.push(NULL);
}
}
void DiskWriteThreadPool::setJobInjector(TaskInjector * ji){
m_jobInjector = ji;
}
bool DiskWriteThreadPool::belowMidFilesAfterPop(int filesPopped) const {
return m_tasks.size() -filesPopped < m_maxFilesReq/2;
......@@ -66,6 +63,7 @@ namespace daemon {
using castor::log::Param;
DiskWriteTaskInterface * ret = m_tasks.pop();
// TODO: completely remove task injection in writers, move it to readers
if(ret)
{
castor::tape::threading::MutexLocker ml(&m_counterProtection);
......@@ -82,7 +80,6 @@ namespace daemon {
tape::utils::suppresUnusedVariable(sp);
m_lc.log(LOG_INFO, "In DiskWriteTaskInterface::popAndRequestMoreJobs(), requesting last call");
m_jobInjector->requestInjection(m_maxFilesReq, m_maxBytesReq, true);
//if we are below mid on both block and files and we are crossing a threshold
//on either files of blocks, then request more jobs
} else if ( belowMidFilesAfterPop(1) && crossingDownFileThreshod(1)) {
......@@ -94,7 +91,6 @@ namespace daemon {
};
tape::utils::suppresUnusedVariable(sp);
m_lc.log(LOG_INFO, "In DiskWriteTaskInterface::popAndRequestMoreJobs(), requesting: files");
m_jobInjector->requestInjection(m_maxFilesReq, m_maxBytesReq, false);
}
}
return ret;
......
......@@ -52,7 +52,6 @@ public:
void waitThreads();
virtual void push(DiskWriteTaskInterface *t);
void finish();
void setJobInjector(TaskInjector * ji);
private:
bool belowMidFilesAfterPop(int filesPopped) const ;
......@@ -87,7 +86,6 @@ private:
std::vector<DiskWriteWorkerThread *> m_threads;
castor::tape::threading::Mutex m_counterProtection;
TaskInjector * m_jobInjector;
uint32_t m_maxFilesReq;
uint64_t m_maxBytesReq;
......
......@@ -29,7 +29,6 @@ namespace unitTests{
TEST(castor_tape_tapeserver_daemon, DiskWriteThreadPoolTest){
using ::testing::_;
MockTaskInjector tskInjectorl;
MockClient client;
castor::log::StringLogger log("castor_tape_tapeserver_daemon_DiskWriteThreadPoolTest");
castor::log::LogContext lc(log);
......@@ -42,7 +41,6 @@ namespace unitTests{
RecallMemoryManager mm(10,100);
DiskWriteThreadPool dwtp(2,5,500,report,lc);
dwtp.setJobInjector(&tskInjectorl);
dwtp.startThreads();
castor::tape::tapegateway::FileToRecallStruct file;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment