#include <i_recoveryjob_impl.h>


Definition at line 23 of file i_recoveryjob_impl.h.
Public Member Functions | |
| i_RecoveryJob_i (i_PartitionManager_i &a_iPM, pm_JobMgr &a_jobMgr, i_MediumSeqByVol_t &a_medSeqByVol, i_UIMessageServer_ptr a_uims, bool a_secondTry=false) | |
| ~i_RecoveryJob_i () | |
Private Member Functions | |
| void | Execute () |
| void | ProcessFRI (pm_FRIInfo a_FRIInfo) |
| void | SetRecoveryFlagOnVolumes () |
Private Attributes | |
| log_CLASSID_m | |
| i_RecoveryJob_i::i_RecoveryJob_i | ( | i_PartitionManager_i & | a_iPM, | |
| pm_JobMgr & | a_jobMgr, | |||
| i_MediumSeqByVol_t & | a_medSeqByVol, | |||
| i_UIMessageServer_ptr | a_uims, | |||
| bool | a_secondTry = false | |||
| ) |
Definition at line 41 of file i_recoveryjob_impl.cpp.
References cmn_CleanDir(), dbg_LOW, ui_MsgWriter::DisplayMessage(), fsc_GetReorgDir(), i_PartitionManager_i::GetName(), i_Job_i::GetResources(), ipc_EXEC_m, i_JobParams::jobID, i_JobParams::jobPriority, i_JobParams::jobType, jt_RECOVERY, log_DBG_m, log_FUNC_m, ipc_Log::LogJobParams(), ipc_Log::LogResources(), i_PartitionManager_i::m_config, i_Job_i::m_iJobParams, i_MaintFriJob_i::m_iPM, i_PartitionManager_i::m_iRM, i_MaintFriJob_i::m_uiMsgWriter, cfg_PMCfg::recoveryPriority, and SetRecoveryFlagOnVolumes().
Referenced by ~i_RecoveryJob_i().
00047 : i_MaintFriJob_i(a_iPM, a_jobMgr, a_medSeqByVol, a_uims, "", a_secondTry) 00048 { 00049 log_FUNC_m(i_RecoveryJob_i); 00050 00051 log_DBG_m(dbg_LOW, "" << endl << 00052 "Recovery Job Created:" << endl << 00053 ipc_Log::LogJobParams(m_iJobParams) << endl << 00054 ipc_Log::LogResources(GetResources()) << endl); 00055 00056 ostringstream msg; 00057 msg << "Recovery started (JobID: " << m_iJobParams.jobID << ")."; 00058 m_uiMsgWriter.DisplayMessage(msg.str()); 00059 00060 m_iJobParams.jobPriority = m_iPM.m_config.recoveryPriority; 00061 m_iJobParams.jobType = jt_RECOVERY; 00062 00063 //recovery flag in RMDB is set for volumes got through parameter a_medSeqByVol 00064 //redundancy - if they are set, it sets them again 00065 SetRecoveryFlagOnVolumes(); 00066 00067 //recovery flag in RMDB is set for volumes got through parameter a_medSeqByVol 00068 //redundancy - if they are set, it sets them again 00069 SetRecoveryFlagOnVolumes(); 00070 00071 //clear all scanned statuses for volumes 00072 ipc_EXEC_m( 00073 m_iPM.m_iRM->ClearReorgScan(m_iPM.GetName().c_str()); 00074 ); 00075 00076 //delete old reorg files if they exist 00077 cmn_Path reorgDir = fsc_GetReorgDir(m_iPM.GetName()); 00078 cmn_CleanDir(reorgDir); 00079 }


| i_RecoveryJob_i::~i_RecoveryJob_i | ( | ) |
Definition at line 81 of file i_recoveryjob_impl.cpp.
References i_PartitionManager_i::ClearRecoveryRunning(), i_RecoveryJob_i(), i_SUCCEDED, i_Job_i::IsAborted(), log_FUNC_m, i_MaintFriJob_i::m_allFriSuccess, i_MaintFriJob_i::m_iPM, i_Job_i::m_status, and i_PartitionManager_i::RecoveryModeClear().
00081 { 00082 log_FUNC_m(~i_RecoveryJob_i()); 00083 if ((m_allFriSuccess) && 00084 m_status == i_SUCCEDED && 00085 !IsAborted()) { 00086 m_iPM.RecoveryModeClear(); 00087 } 00088 else { 00089 m_iPM.ClearRecoveryRunning(); 00090 } 00091 }

| void i_RecoveryJob_i::Execute | ( | ) | [private, virtual] |
Implements i_MaintFriJob_i.
Definition at line 229 of file i_recoveryjob_impl.cpp.
References i_MaintFriJob_i::Execute(), and log_FUNC_m.
00229 { 00230 log_FUNC_m(Execute); 00231 00232 i_MaintFriJob_i::Execute(); 00233 }

| void i_RecoveryJob_i::ProcessFRI | ( | pm_FRIInfo | a_FRIInfo | ) | [private, virtual] |
Implements i_MaintFriJob_i.
Definition at line 104 of file i_recoveryjob_impl.cpp.
References i_VolInfo_t::blockSize, dbg_DETAIL, dbg_LOW, dbg_NORM, cmn_File::DeleteF(), cmn_Global::dirs, ui_MsgWriter::DisplayMessage(), evt_ERROR, evt_WARNING, i_PartitionManager_i::FSCRecovery(), 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_m, log_WriteEvent(), ipc_Log::LogVolInfo(), i_MaintFriJob_i::m_allFriSuccess, pm_FRIInfo::m_beaNum, i_Job_i::m_iJobParams, i_MaintFriJob_i::m_iPM, pm_FRIInfo::m_lastDataPos, i_MaintFriJob_i::m_mediumInfoVec, i_Job_i::m_rm, i_MaintFriJob_i::m_uiMsgWriter, pm_FRIInfo::m_volNum, i_VolInfo_t::medVolID, ivd_Directories::tmp, and i_VolInfo_t::volNum.
00104 { 00105 log_FUNC_m(ProcessFRI); 00106 00107 try { 00108 UInt32_t mediumKey = GetResources()[a_FRIInfo.m_beaNum].mediumKey; 00109 log_DBG_m(dbg_LOW,"Calling FSC for Recovery for medium " << mediumKey); 00110 log_DBG_m(dbg_NORM,"Invoking Recovery for " << 00111 m_mediumInfoVec[a_FRIInfo.m_beaNum].m_friVolStatus.size() << 00112 " volumes."); 00113 00114 MediumInfo_t &medInfo = m_mediumInfoVec[a_FRIInfo.m_beaNum]; 00115 00116 UInt32_t currentVol(0); 00117 bool found(false); 00118 for (UInt32_t i(0); i < medInfo.m_friVolStatus.size(); i++){ 00119 if (medInfo.m_friVolStatus[i].m_volInfo.volNum == a_FRIInfo.m_volNum){ 00120 found = true; 00121 log_DBG_m(dbg_DETAIL,"i=" << i << endl << 00122 ipc_Log::LogVolInfo(medInfo.m_friVolStatus[i].m_volInfo)); 00123 00124 currentVol = i; 00125 break; 00126 } 00127 } 00128 if (!found){ 00129 throw ivd_Error(ie_FATAL_ERROR, "Medium Volume does not exist."); 00130 } 00131 00132 i_VolInfo_t &volInfo = medInfo.m_friVolStatus[currentVol].m_volInfo; 00133 00134 try { 00135 try { 00136 ostringstream msg; 00137 msg << "Recovery started for volume: " << volInfo.medVolID; 00138 m_uiMsgWriter.DisplayMessage(msg.str()); 00139 log_DBG_m(dbg_LOW, msg.str()); 00140 00141 m_iPM.FSCRecovery( 00142 string(volInfo.medVolID), 00143 volInfo.volNum, 00144 mediumKey, 00145 volInfo.blockSize, 00146 a_FRIInfo.m_lastDataPos); 00147 00148 msg.str(""); 00149 msg << "Recovery finished for volume: " << volInfo.medVolID; 00150 m_uiMsgWriter.DisplayMessage(msg.str()); 00151 log_DBG_m(dbg_LOW, msg.str()); 00152 00153 // set FRI processed 00154 medInfo.m_friVolStatus[currentVol].m_processed = true; 00155 00156 //delete tmp/fri 00157 try { 00158 cmn_Path friPath = g_cmn.dirs.tmp + 00159 string("fri") + 00160 string(volInfo.medVolID); 00161 00162 cmn_File delFri(friPath); 00163 delFri.DeleteF(); 00164 } 00165 catch (ivd_Exception& e){ 00166 log_DBG_m(dbg_LOW, "Error while " 00167 "deleting tmp fri File: " << endl << e 00168 << endl << "Continuing recovery"); 00169 //ignore this error 00170 } 00171 00172 // anounce RM that volume is recovered. 00173 ipc_EXEC_m( 00174 ostringstream msg; 00175 msg << "Clearing recovery flag " << volInfo.medVolID; 00176 m_uiMsgWriter.DisplayMessage(msg.str()); 00177 00178 m_rm->ClearRecoveryFlag( 00179 CORBA::string_dup(volInfo.medVolID) ); 00180 ); 00181 } 00182 catch (ivd_DFError) { 00183 if (medInfo.m_friVolStatus[currentVol].m_recreated) { 00184 ostringstream sstr; 00185 sstr << "Got bad data even on data volume" 00186 << volInfo.medVolID << 00187 ". Set volume as unused and skip it."; 00188 log_WriteEvent(evt_ERROR, sstr.str(), 00189 GetJobTypeText(), 00190 m_iJobParams.jobID ); 00191 00192 m_uiMsgWriter.DisplayMessage(sstr.str()); 00193 m_allFriSuccess = false; 00194 } 00195 else { 00196 ostringstream sstr; 00197 sstr << "Bad data format on volume" 00198 << volInfo.medVolID << 00199 ", retry with scanning data volume."; 00200 log_WriteEvent( evt_WARNING, 00201 sstr.str(), 00202 GetJobTypeText(), 00203 m_iJobParams.jobID ); 00204 m_uiMsgWriter.DisplayMessage(sstr.str()); 00205 m_allFriSuccess = false; 00206 00207 #if TGT_OS_linux 00208 #warning "TODO: restart fri recreation for this volume" 00209 #elif TGT_OS_windows 00210 #pragma message ("TODO: restart fri recreation for this volume") 00211 #endif 00212 } 00213 } 00214 } catch (ivd_Exception& e) { 00215 ostringstream msg; 00216 msg << "Recovery of volume " << volInfo.medVolID << 00217 " failed" << endl << e; 00218 m_uiMsgWriter.DisplayMessage(msg.str()); 00219 00220 m_allFriSuccess = false; 00221 log_ERR_m(msg.str()); 00222 } 00223 } catch(ivd_Error&e){ 00224 log_ERR_m("Exception called while processing FRI for medium:" << 00225 GetResources()[a_FRIInfo.m_beaNum].barcode << endl << e); 00226 } 00227 }

| void i_RecoveryJob_i::SetRecoveryFlagOnVolumes | ( | ) | [private] |
Definition at line 93 of file i_recoveryjob_impl.cpp.
References ipc_EXEC_m, log_FUNC_m, MediumInfo_t::m_friVolStatus, i_MaintFriJob_i::m_mediumInfoVec, i_Job_i::m_rm, and i_VolInfo_t::medVolID.
Referenced by i_RecoveryJob_i().
00093 { 00094 log_FUNC_m(SetRecoveryFlagOnVolumes); 00095 for (UInt32_t i(0); i < m_mediumInfoVec.size(); i++){ //for each volume 00096 MediumInfo_t & med = m_mediumInfoVec[i]; 00097 for (UInt32_t j(0); j < med.m_friVolStatus.size(); j++){ 00098 i_VolInfo_t medVol = med.m_friVolStatus[j].m_volInfo; 00099 ipc_EXEC_m(m_rm->SetRecoveryFlag(medVol.medVolID);); 00100 } 00101 } 00102 }

i_RecoveryJob_i::log_CLASSID_m [private] |
1.5.6