Classes | Defines | Typedefs | Enumerations | Functions | Variables

Partition Manager
[Server]

The Main objective of the Partition Manager is to Create new Migration or Recall Jobs. More...

Collaboration diagram for Partition Manager:

Classes

class  job_finishedStatus
class  job_Manager
class  i_DelExpiredFilesJob_i
class  i_FSCCheckJob_i
struct  friVolStatus_t
struct  MediumInfo_t
class  i_MaintFriJob_i
class  i_MediumCheckJob_i
class  pm_AssignResThread
class  i_MigrationJob_i
struct  cfg_Tree
class  cfg_PM
class  i_PartitionManager_i
 CORBA servant for i_PartitionManager. More...
class  pm_RecallClientThread
class  i_RecallJob_i
class  pm_EfficientRecallClientThread
class  i_EfficientRecallJob_i
class  i_RecoveryJob_i
class  i_RecreatedIVDFSJob_i
class  i_RedundantCopyJob_i
class  i_ReorgJob_i
class  i_ReorgScanJob_i
class  i_ThreadJob_i
struct  pm_File_t
class  pm_FileList

Defines

#define job_COUNT_NO_LIMITS   (0)
 <Description:> A more elaborate class description that describes all aspects of class usage etc.
#define job_RECALL_FACTOR   (2)
#define MAX_WAIT_FOR_BEA_TO_START   (10*cfg_MINUTE)
#define evt_MAINTJOB   "MAINTENANCE"
 <Description:> A more elaborate class description that describes all aspects of class usage etc.

Typedefs

typedef vector< i_Job_i * > job_JobList_v_t
typedef job_JobList_v_t::iterator job_Iterator_t
typedef vector< pm_File_tpm_FileList_v

Enumerations

enum  mj_operationType_e {
  mj_CHECK_FSC_VS_IVDFS, mj_CHECK_FSC_VS_MEDIA,
  mj_SENTINEL
}

Functions

 i_MediumCheckJob_i::~i_MediumCheckJob_i ()
virtual void i_MediumCheckJob_i::CompleteJob (i_CompletionStatus_e a_status)
void i_MediumCheckJob_i::Execute ()
void i_MediumCheckJob_i::ProcessFRI (pm_FRIInfo a_FRIInfo)
virtual i_ThreadJob_i::~i_ThreadJob_i ()
virtual void i_ThreadJob_i::MediumOperationComplete (i_Index_t a_beaNum, i_CompletionStatus_e a_status)
virtual void i_ThreadJob_i::CompleteJob (i_CompletionStatus_e a_status)
virtual void i_ThreadJob_i::Remove ()
i_FSC_ptr i_ThreadJob_i::GetFSC ()
virtual void i_ThreadJob_i::GetNewResources (i_Index_t a_resNum)
virtual i_JobRequestList_ti_ThreadJob_i::GetFiles ()
virtual void i_ThreadJob_i::AssignResources (const i_ResourceList_t &a_resources)
virtual void i_ThreadJob_i::Execute ()=0

Variables

i_PartitionManager_ii_MediumCheckJob_i::m_iPM
bool i_MediumCheckJob_i::m_autoCorrect
bool i_MediumCheckJob_i::m_removeMissingOnMedia
ivd_MediaChkStat_t i_MediumCheckJob_i::m_totalChkStat
 i_MediumCheckJob_i::log_CLASSID_m
 i_ThreadJob_i::log_CLASSID_m
i_PartitionManager_ii_ThreadJob_i::m_iPM
ui_MsgWriter i_ThreadJob_i::m_uiMsgWriter

Detailed Description

The Main objective of the Partition Manager is to Create new Migration or Recall Jobs.

Each new Job is a new CORBA Object. Within this job a executor thread is started which starts the Job activity.

Migration Job:

  1. DiskBuffer space check and allocation
  2. DiskBuffer file is created by Client
  3. Resources request from Resource Manger
  4. Job waits for Resources When Job get resources:
  5. Library Agent for Load/Unload is called
  6. Back-End Agent (BEA) is started (SVC)
  7. Use Resources is invoked on Back-End Agent to start actually migrating data
  8. When BEA finishes CompleteJob is called
  9. Resources are released
  10. Complete Migration on Client is called
  11. DiskBuffer File is deleted

Recall Job:

  1. Positions of Copies are requested from FSC (File System Catalog)
  2. Best Copy is choosen by RM
  3. Resources request from Resource Manger
  4. Job waits for Resources When Job get resources:
  5. Library Agent for Load/Unload is called
  6. Back-End Agent (BEA) is started (SVC)
  7. Use Resources is invoked on Back-End Agent to start actually migrating data
  8. When BEA finishes CompleteJob is called
  9. Resources are released
  10. Recall on Client is called
  11. DiskBuffer File is deleted

Define Documentation

#define evt_MAINTJOB   "MAINTENANCE"

<Description:> A more elaborate class description that describes all aspects of class usage etc.

Author:
Toni Pljakoski, HERMES SoftLab
See also:
<reference>

Definition at line 52 of file pm.h.

Referenced by i_DelExpiredFilesJob_i::Execute().

#define job_COUNT_NO_LIMITS   (0)

<Description:> A more elaborate class description that describes all aspects of class usage etc.

Author:
Toni Pljakoski, HERMES SoftLab
See also:
<reference>

Definition at line 59 of file jobs.h.

Referenced by job_Manager::AddJobToList(), and job_Manager::RemoveFromList().

#define job_RECALL_FACTOR   (2)

Definition at line 60 of file jobs.h.

#define MAX_WAIT_FOR_BEA_TO_START   (10*cfg_MINUTE)

Definition at line 61 of file jobs.h.

Referenced by i_Job_i::WaitBea().


Typedef Documentation

typedef job_JobList_v_t::iterator job_Iterator_t

Definition at line 72 of file jobs.h.

Definition at line 71 of file jobs.h.

Definition at line 69 of file pm.h.


Enumeration Type Documentation

Enumerator:
mj_CHECK_FSC_VS_IVDFS 
mj_CHECK_FSC_VS_MEDIA 
mj_SENTINEL 

Definition at line 55 of file pm.h.

             {
    mj_CHECK_FSC_VS_IVDFS,
    mj_CHECK_FSC_VS_MEDIA,

    mj_SENTINEL
} mj_operationType_e;


Function Documentation

void i_ThreadJob_i::AssignResources ( const i_ResourceList_t a_resources  )  [virtual, inherited]

Reimplemented from i_Job_i.

Definition at line 167 of file i_threadjob_impl.cpp.

References ie_NYI.

                                                                      { 
    throw ivd_InternalError(ie_NYI, "");
}

void i_MediumCheckJob_i::CompleteJob ( i_CompletionStatus_e  a_status  )  [virtual, inherited]

Reimplemented from i_MaintFriJob_i.

Definition at line 270 of file i_mediumcheckjob_impl.cpp.

References dbg_DETAIL, ui_MsgWriter::DisplayMessage(), i_Job_i::GetJobTypeText(), ui_MsgWriter::GetStreamPath(), i_SUCCEDED, i_Job_i::IsAborted(), i_JobParams::jobID, log_DBG_m, log_FUNC_m, log_WriteEvent(), i_Job_i::m_iJobParams, i_MediumCheckJob_i::m_totalChkStat, and i_MaintFriJob_i::m_uiMsgWriter.

                                                                  {
    log_FUNC_m(CompleteJob);
    
    if (a_status == i_SUCCEDED
        && !IsAborted()) {
    
        log_DBG_m(dbg_DETAIL, "Check for not checked volumes.");
    }
    ostringstream sstr;
    sstr
        << "Finished FSC check "
        << "(total):"
        << m_totalChkStat;
        
    if (  m_totalChkStat.missingInFSC 
       || m_totalChkStat.mismatch) {
       sstr << endl << "    Look into log file for details. '" 
            << m_uiMsgWriter.GetStreamPath() << "'";
    }
    
    m_uiMsgWriter.DisplayMessage(sstr.str());
    log_WriteEvent(sstr.str(), GetJobTypeText(), m_iJobParams.jobID);

    i_MaintFriJob_i::CompleteJob(a_status);
}

Here is the call graph for this function:

void i_ThreadJob_i::CompleteJob ( i_CompletionStatus_e  a_status  )  [virtual, inherited]

Implements i_Job_i.

Definition at line 106 of file i_threadjob_impl.cpp.

References evt_ERROR, evt_WARNING, i_Job_i::GetJobTypeText(), i_CLIENT_ERROR, i_SUCCEDED, ipc_EXEC_m, i_JobParams::jobID, log_ERR_m, log_FUNC_m, log_WriteEvent(), i_Job_i::m_aborted, i_Job_i::m_iJobParams, i_Job_i::m_status, and i_ThreadJob_i::Remove().

                                                              {
    log_FUNC_m(CompleteJob);

    m_status = a_status;

    try {
        if (a_status == i_SUCCEDED) {
            log_WriteEvent("Finished.", 
                           GetJobTypeText(), m_iJobParams.jobID);
        }
        else if (m_aborted) {
            log_WriteEvent(evt_WARNING, "Aborted.", 
                           GetJobTypeText(), m_iJobParams.jobID);
        } 
        else if (a_status == i_CLIENT_ERROR) {
            log_WriteEvent(evt_ERROR, "Failed (client error).",
                           GetJobTypeText(), m_iJobParams.jobID);
        }
        else {
            ostringstream os;
            os << "Failed (" << a_status << ").";
            log_WriteEvent(evt_ERROR, os.str(),
                           GetJobTypeText(), m_iJobParams.jobID);
        }
        //DEL        m_iJobParams.status = job_FINISHED;

        ipc_EXEC_m( Remove(); );

    }
    catch (ivd_Exception& e) {
        log_ERR_m(e);
    }
    catch (ivd_InternalError& ie) {
        log_ERR_m(ie);
    }
    catch (...) {
        log_ERR_m("Caught unknown" );
    }
}

Here is the call graph for this function:

virtual void i_ThreadJob_i::Execute (  )  [protected, pure virtual, inherited]
void i_MediumCheckJob_i::Execute (  )  [private, virtual, inherited]

Implements i_MaintFriJob_i.

Definition at line 233 of file i_mediumcheckjob_impl.cpp.

References i_FSC_i::CollectByVolume(), dbg_DETAIL, ui_MsgWriter::DisplayError(), ui_MsgWriter::DisplayMessage(), ivd_BaseException::GetFriendly(), ipc_EXEC_m, i_Job_i::IsAborted(), log_DBG_m, log_FUNC_m, i_PartitionManager_i::m_iFSCi, i_MediumCheckJob_i::m_iPM, i_Job_i::m_status, and i_MaintFriJob_i::m_uiMsgWriter.

                                 {
    log_FUNC_m(Execute);

     try {
        ipc_EXEC_m(
            ostringstream msg;
            msg << "Preparing FSC for check.";
            m_uiMsgWriter.DisplayMessage(msg.str());

            try {
                m_iPM.m_iFSCi->CollectByVolume();
                msg.str("");
                msg << "Preparing of FSC finished.";
                m_uiMsgWriter.DisplayMessage(msg.str());

                if (IsAborted()) {
                    m_status = i_ABORTED;
                    return;
                }
            }
            catch (...) {
            }
            log_DBG_m(dbg_DETAIL, msg.str());

        );
    } 
    catch (ivd_Exception &e) {
        ostringstream err;
        err << e.GetFriendly() << endl;
        m_uiMsgWriter.DisplayError(err.str());
        m_status = i_FAILED;
        throw;
    }
    i_MaintFriJob_i::Execute();
   
}

Here is the call graph for this function:

i_JobRequestList_t * i_ThreadJob_i::GetFiles ( void   )  [virtual, inherited]

Implements i_Job_i.

Definition at line 162 of file i_threadjob_impl.cpp.

References ie_NYI.

                                           { 
    throw ivd_InternalError(ie_NYI, "");
}

i_FSC_ptr i_ThreadJob_i::GetFSC ( void   )  [virtual, inherited]

Implements i_Job_i.

Definition at line 152 of file i_threadjob_impl.cpp.

References ie_NYI.

                               { 
    throw ivd_InternalError(ie_NYI, "");
}

void i_ThreadJob_i::GetNewResources ( i_Index_t  a_resNum  )  [virtual, inherited]

Implements i_Job_i.

Definition at line 157 of file i_threadjob_impl.cpp.

References ie_NYI.

                                                      { 
    throw ivd_InternalError(ie_NYI, "");
}

void i_ThreadJob_i::MediumOperationComplete ( i_Index_t  a_beaNum,
i_CompletionStatus_e  a_status 
) [virtual, inherited]

Implements i_Job_i.

Definition at line 92 of file i_threadjob_impl.cpp.

References dbg_NORM, i_Job_i::GetJobTypeText(), i_JobParams::jobID, log_DBG_m, log_FUNC_m, ipc_Log::LogStatus(), and i_Job_i::m_iJobParams.

{
    log_FUNC_m(MediumOperationComplete);
    log_DBG_m(dbg_NORM,
        GetJobTypeText() <<
        " Completed " << a_beaNum <<
        "  status: [" << a_status << "]" <<
        ipc_Log::LogStatus(a_status) << endl <<
        m_iJobParams.jobID);
}

Here is the call graph for this function:

void i_MediumCheckJob_i::ProcessFRI ( pm_FRIInfo  a_FRIInfo  )  [private, virtual, inherited]

Implements i_MaintFriJob_i.

Definition at line 115 of file i_mediumcheckjob_impl.cpp.

References i_Medium_t::barcode, i_VolInfo_t::blockSize, i_FSC_i::CheckWithMedVolume(), dbg_DETAIL, dbg_LOW, cmn_File::DeleteF(), cmn_Global::dirs, ui_MsgWriter::DisplayMessage(), evt_ERROR, evt_WARNING, g_cmn, i_Job_i::GetJobTypeText(), i_Job_i::GetResources(), ie_FATAL_ERROR, ipc_EXEC_m, ivd_Error, i_JobParams::jobID, log_DBG_m, log_ERR_m, log_FUNC_A_m, log_WriteEvent(), ipc_Log::LogMedium(), ipc_Log::LogVolInfo(), i_MediumCheckJob_i::m_autoCorrect, pm_FRIInfo::m_beaNum, MediumInfo_t::m_friVolStatus, i_PartitionManager_i::m_iFSCi, i_Job_i::m_iJobParams, i_MediumCheckJob_i::m_iPM, pm_FRIInfo::m_lastDataPos, MediumInfo_t::m_medium, i_MaintFriJob_i::m_mediumInfoVec, ivd_Product::m_nameShortLC, i_MediumCheckJob_i::m_removeMissingOnMedia, i_MediumCheckJob_i::m_totalChkStat, i_MaintFriJob_i::m_uiMsgWriter, pm_FRIInfo::m_volNum, i_VolInfo_t::medVolID, ivd_MediaChkStat_t::mismatch, ivd_MediaChkStat_t::missingInFSC, i_JobParams::partName, cmn_Global::prod, ivd_Directories::tmp, and i_VolInfo_t::volNum.

                                                       {
    log_FUNC_A_m(ProcessFRI,    "m_beaNum:" << a_FRIInfo.m_beaNum <<
                                ", m_volNum:" << a_FRIInfo.m_volNum <<
                                ", m_lastDataPos:" << a_FRIInfo.m_lastDataPos);

    log_DBG_m(dbg_DETAIL,"Calling FSC for Medium Check");

    ivd_MediaChkStat_t   mediumChkStat;

    UInt32_t mediumKey    = GetResources()[a_FRIInfo.m_beaNum].mediumKey;
    MediumInfo_t &medInfo = m_mediumInfoVec[a_FRIInfo.m_beaNum];
    log_DBG_m(dbg_DETAIL, "Processing medium: " << endl <<
                        ipc_Log::LogMedium(medInfo.m_medium));

    UInt32_t currentVol(0);
    bool found(false);
    for (UInt32_t i(0); i < medInfo.m_friVolStatus.size(); i++){
        if (medInfo.m_friVolStatus[i].m_volInfo.volNum == a_FRIInfo.m_volNum  ){
            found = true;
            log_DBG_m(dbg_DETAIL,"i=" << i << endl <<
                ipc_Log::LogVolInfo(medInfo.m_friVolStatus[i].m_volInfo));
            currentVol = i;
            break;
        }
    }
    if (!found){
        throw ivd_Error(ie_FATAL_ERROR, "Medium Volume does not exist.");
    }
    
    i_VolInfo_t &volInfo = medInfo.m_friVolStatus[currentVol].m_volInfo;
       
    try {
        try {
            ipc_EXEC_m(
                m_iPM.m_iFSCi->CheckWithMedVolume(
                    string(volInfo.medVolID), 
                    volInfo.volNum,
                    string(medInfo.m_medium.barcode),
                    mediumKey,
                    volInfo.blockSize,
                    string(m_iJobParams.partName),
                    m_autoCorrect,
                    m_removeMissingOnMedia,
                    m_uiMsgWriter,
                    mediumChkStat,
                    a_FRIInfo.m_lastDataPos);
            );

            // set FRI processed
            medInfo.m_friVolStatus[currentVol].m_processed = true;

            try {
                cmn_Path friPath =  g_cmn.dirs.tmp + 
                                    string("fri") + 
                                    string(volInfo.medVolID);

                cmn_File delFri(friPath);
                delFri.DeleteF();
            } catch (ivd_Exception& e){
                log_DBG_m(dbg_LOW,
                    "Non-fatal Error while deleting tmp fri File: " << endl << e
                    << endl << "Continuing check");
                //ignore this error                                        
            }

        }
        catch (ivd_DFError &dfe) {
            log_ERR_m("Error while Checking Volume: " << dfe);
            if (medInfo.m_friVolStatus[currentVol].m_recreated) {
                ostringstream sstr;
                sstr
                    << "Got bad data even on data volume"
                    << volInfo.medVolID
                    << ". Set volume as unused and skip it.";

                log_WriteEvent(evt_ERROR, sstr.str(), 
                            GetJobTypeText(), 
                            m_iJobParams.jobID );
                m_uiMsgWriter.DisplayMessage(sstr.str());
            }
            else {
                ostringstream sstr;
                sstr << "Corrupted FRI file for volume "
                        << volInfo.medVolID
                        << ". Use '" << g_cmn.prod.m_nameShortLC
                        << "medium --recreate-fri' and run "
                        << g_cmn.prod.m_nameShortLC << "check again.";

                log_WriteEvent(
                    evt_WARNING, sstr.str(),
                    GetJobTypeText(), m_iJobParams.jobID );
                
                m_uiMsgWriter.DisplayMessage(sstr.str());
        #if TGT_OS_linux
            #warning "TODO: restart fri recreation for this volume"
        #elif TGT_OS_windows
            #pragma message ("TODO: restart fri recreation for this volume")
        #endif
            }
        }
    } catch (ivd_Exception& e) {
        log_ERR_m("Check of volume " << volInfo.medVolID << " failed" << endl << e)
    }
    
    ostringstream sstr;
    sstr << "Finished FSC check (medium: " << medInfo.m_medium.barcode << "):"
         << mediumChkStat;
         
    if (  mediumChkStat.missingInFSC 
       || mediumChkStat.mismatch) {
        log_WriteEvent(sstr.str(), GetJobTypeText(), m_iJobParams.jobID);
    }

    m_uiMsgWriter.DisplayMessage(sstr.str());
    m_totalChkStat += mediumChkStat;
}

Here is the call graph for this function:

void i_ThreadJob_i::Remove (  )  [virtual, inherited]

Reimplemented from i_Job_i.

Definition at line 147 of file i_threadjob_impl.cpp.

Referenced by i_ThreadJob_i::CompleteJob().

Here is the caller graph for this function:

i_MediumCheckJob_i::~i_MediumCheckJob_i (  )  [inherited]
i_ThreadJob_i::~i_ThreadJob_i (  )  [virtual, inherited]

Definition at line 84 of file i_threadjob_impl.cpp.

References ui_MsgWriter::DisplayMessage(), i_JobParams::jobID, log_FUNC_m, i_Job_i::m_iJobParams, and i_ThreadJob_i::m_uiMsgWriter.

                             {
    log_FUNC_m(~i_ThreadJob_i);
    ostringstream msg;
    msg << "Finished (JobID: " << m_iJobParams.jobID << ").";
    m_uiMsgWriter.DisplayMessage(msg.str());
}

Here is the call graph for this function:


Variable Documentation

Reimplemented from i_MaintFriJob_i.

Definition at line 64 of file i_mediumcheckjob_impl.h.

Reimplemented from i_Job_i.

Reimplemented in i_DelExpiredFilesJob_i, i_FSCCheckJob_i, i_RecreatedIVDFSJob_i, and i_ReorgScanJob_i.

Definition at line 61 of file i_threadjob_impl.h.

bool i_MediumCheckJob_i::m_autoCorrect [private, inherited]
i_PartitionManager_i& i_ThreadJob_i::m_iPM [protected, inherited]
bool i_MediumCheckJob_i::m_removeMissingOnMedia [private, inherited]

Definition at line 60 of file i_mediumcheckjob_impl.h.

Referenced by i_MediumCheckJob_i::ProcessFRI().