i_FSC_i Class Reference
[File System Catalog]

#include <i_FSC_impl.h>

Inheritance diagram for i_FSC_i:

Inheritance graph
[legend]
Collaboration diagram for i_FSC_i:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 37 of file i_FSC_impl.h.


Public Member Functions

 i_FSC_i (fio_DataBaseID_t a_dbID, const string &a_partitionName, bool &a_down, UInt32_t a_numPools)
virtual ~i_FSC_i ()
i_CollocationIDs_tInsertSplitFromFRIBlock (const i_FRIBlockInfo_t &a_friInfo, const i_DataBlock_t &a_friBlock)
void CompleteMigration (ivd_MigrationID_t a_migrationID, UInt32_t a_copies)
i_FileIDs_tGetFileIDs (i_Count_t a_count)
i_CopiesPos_v_tGetCopiesPos (i_FileID_t a_fileID, i_MigID_t &a_migID, i_FileSize_t a_fileSize)
i_FSCfileState_v_tCheckWithIVDFS (const i_IvdfsFileInfo_v_t &a_ivdfsFileInfo)
i_FileHistoryList_tGetFileHistory (i_FileID_t a_fileID)
i_FileID_t ChkLastFileID (i_FileID_t a_fileID)
void ReleaseVolEntries (i_DBKey_t a_mediumKey, i_Index_t a_medVolNum)
i_Status_t Suspend ()
void Continue (i_Status_t a_status)
void FSCRecovery (const string &a_medVolIDstr, ivd_MedVolNum_t a_medVolNum, ivd_MediaKey_t a_mediaKey, UInt32_t a_blkSize, UInt32_t a_lastDataPosition)
 FSCRecovery method is called to reaplly the FSC from FRI file the file must be locatted on /var/opt/ivd/tmp storen in global var g_cmn.dirs.tmp In case of wrong FRI format an ivd_DFError() exception is returned.
void CollectByVolume ()
 Collect by volume scan through FSC and store each split to medVolOfs files.
ivd_ScanInfo_v_tReorgScan (ivd_Time32_t a_expDate, UInt32_t a_numGener)
 Scan through FSC to collect data for reorganization.
void DelExpiredFiles (ui_MsgWriter &a_msgw, i_HSM_ptr a_ihsm, fsc_FileExpiration &a_fileExp, char a_clientPathSeparator)
void RedundantCopy (fsc_RedunCopyResult_v &a_results, vector< UInt32_t > &a_unavailFilesPerVol, fsc_MediumStatus_v &a_medStat, ivd_MediaKey_t a_origMedKey, vector< UInt32_t > a_origMedVol, bool a_best_effort)
void DeleteEntries (ivd_MediaKey_t a_medKey, vector< UInt32_t > a_medVols)
void CheckWithMedVolume (const string &a_medVolIDstr, ivd_MedVolNum_t a_medVolNum, const string &a_mediumBarCode, ivd_MediaKey_t a_mediaKey, UInt32_t a_blkSize, const string &a_partitionName, bool a_autoCorrect, bool a_removeMissingOnMedia, ui_MsgWriter &a_msgWrite, ivd_MediaChkStat_t &a_totalChkStat, UInt32_t a_lastDataPosition)
UInt32_t GetNumOfUsedFileID ()
void IVDFSRecovery (const string &a_partitionName, i_HSM_ptr a_ihsm, ui_MsgWriter &a_uims)
void IVDFSRecoveryAbort ()
bool IsIVDFSRecoveryRun ()
cmn_Path GetFscPath ()
void SetMediumStatusMember (fsc_MediumStatus_v &ms)
void EfficientRecallGetLocations (i_RecallList_t &a_recallList, fsc_MediumStatus_v &a_medStat, fsc_FileLocStorage &a_fileLocStorage)

Public Attributes

 log_CLASSID_m

Private Attributes

const string m_partitionName
const cmn_Path m_fscPath
fsc_Filesm_fscFiles
fio_DataBase m_fscDB
fsc_DataLMgr m_dataLMgr
bool & m_down
cmn_Mutex m_recoveryInProgress_x
bool m_IVDFSRecoveryRun
bool m_IVDFSRecoveryAbort
cmn_Mutex m_mediaCheckRun_x
bool m_mediaCheckRun
cmn_Mutex m_reorgScanRelease_x
 Only reorg scan or release volume could run at same time.
stx_CacheVec m_friBlockUnpackerCache
 cache that hold current active fsc_FRIblockUnpacker objects it's a vector of pointers to fsc_FRIblockUnpacker It's expected only few active unpackers at same time.
cmn_Mutex m_friBlockUnpackerCache_x
UInt32_t m_numPools
fsc_MediumStatus_v m_ms

Constructor & Destructor Documentation

i_FSC_i::i_FSC_i ( fio_DataBaseID_t  a_dbID,
const string &  a_partitionName,
bool &  a_down,
UInt32_t  a_numPools 
)

Definition at line 65 of file i_FSC_impl.cpp.

References cmn_GetEnvVariable(), fsc_noNSC_c(), g_fsLog, g_updateNSC, log_ivdfs::Init(), log_FUNC_m, log_WriteEvent(), and m_down.

00069         :
00070         m_partitionName(a_partitionName),
00071         m_fscPath(fsc_GetDir(a_partitionName)),
00072         m_fscFiles(new fsc_Files(m_fscPath, false)), // no read only mode (read-write)
00073         m_fscDB(a_dbID, m_fscPath, m_fscFiles),
00074         m_dataLMgr(m_fscDB.GetTransObj()),
00075         m_down(a_down),
00076         m_IVDFSRecoveryRun(false),
00077         m_IVDFSRecoveryAbort(false),
00078         m_mediaCheckRun(false),
00079         m_numPools(a_numPools)
00080 {
00081     log_FUNC_m(i_FSC_i);
00082     m_down = false;
00083 
00084     string sNoNSC = cmn_GetEnvVariable(fsc_noNSC_c);
00085     if (!sNoNSC.empty()) {
00086         g_updateNSC = false;
00087         ostringstream sstr;
00088         sstr << "NSC update is disabled. " 
00089                 << fsc_noNSC_c 
00090                 << " = " << sNoNSC
00091                 << " Environment variable exist and it is not empty.";
00092         log_WriteEvent(sstr.str(), "FSC");
00093     }    
00094     g_fsLog.Init(a_partitionName);
00095 }
//============================================================================//

Here is the call graph for this function:

i_FSC_i::~i_FSC_i (  )  [virtual]

Definition at line 99 of file i_FSC_impl.cpp.

References dbg_DETAIL, log_DBG_m, log_FUNC_m, and m_down.

00099                  {
00100     log_FUNC_m(~i_FSC_i);
00101     log_DBG_m(dbg_DETAIL, " FSC DESTRUCTOR IS CALLED.");
00102     m_down = true;
00103   // add extra destructor code here
00104 }


Member Function Documentation

i_CollocationIDs_t * i_FSC_i::InsertSplitFromFRIBlock ( const i_FRIBlockInfo_t a_friInfo,
const i_DataBlock_t a_friBlock 
)

Definition at line 175 of file i_FSC_impl.cpp.

References cmn_HexDump(), i_FRIBlockInfo_t::copyID, dbg_DETAIL, fsc_DataLMgr::FlushChangesAndCleanCache(), g_DataLcache, g_fscUpdate_x, stx_CacheVec::Get(), stx_CacheEl::GetCacheKey(), ivd_BaseException::GetError(), df_SplitInfoUnpacker::GetMediumKey(), df_SplitInfoUnpacker::GetMedVolNum(), df_SplitInfoUnpacker::GetMinorCollocationIds(), df_RecReader::GetPrevRecType(), ie_DF_INVSEQ, stx_CacheVec::Insert(), ipc_CATCH_IVD_THROW_CORBA_m, fsc_FRIblockUnpacker::KeyGen(), log_DBG_m, log_ERR_m, log_FUNC_m, m_dataLMgr, m_friBlockUnpackerCache, m_friBlockUnpackerCache_x, i_FRIBlockInfo_t::mediaKey, i_FRIBlockInfo_t::medVolNum, i_FRIBlockInfo_t::migID, NULL, rec_ExpectFRIStart_c, rec_FRIEnd_c, stx_CacheVec::RemoveEl(), stx_CacheArray< _MaxCacheSize >::Resize(), and df_RecReader::Unpack().

00177                                      {
00178 
00179     log_FUNC_m(InsertSplitFromFRIBlock);
00180 
00181     cmn_MutexLock l(g_fscUpdate_x);
00182 
00183     try {
00184         i_CollocationIDs_t_var collocationIds(new i_CollocationIDs_t);
00185         log_DBG_m(dbg_DETAIL, "InsertSplitFromFRIBlock() mediumKey " << a_friInfo.mediaKey
00186             << ", medVolNum " << a_friInfo.medVolNum
00187             << ", migID " << a_friInfo.migID
00188             << ", copyID " << a_friInfo.copyID
00189             << endl);
00190 
00191         stx_CacheKey_t key = fsc_FRIblockUnpacker::KeyGen(a_friInfo.migID,
00192                                                           a_friInfo.copyID);
00193         { cmn_MutexLock l(m_friBlockUnpackerCache_x);
00194         
00195             fsc_FRIblockUnpacker* friUnpacker_p 
00196                 = static_cast<fsc_FRIblockUnpacker*>(m_friBlockUnpackerCache.Get(key));
00197             UInt32_t blockSize = a_friBlock.length();
00198             if (friUnpacker_p == NULL) {
00199                 friUnpacker_p = new fsc_FRIblockUnpacker(key, 
00200                                                         m_dataLMgr, 
00201                                                         // dataL cache size
00202                                                         // average size of FRI file size is 512 bytes
00203                                                         blockSize >> 9,
00204                                                         a_friInfo.medVolNum,
00205                                                         a_friInfo.mediaKey,
00206                                                         blockSize);
00207                 m_friBlockUnpackerCache.Insert(friUnpacker_p);
00208             }
00209             else {
00210                 log_DBG_m(dbg_DETAIL, "Found fsc_FRIblockUnpacker, Key = "
00211                     << " migID " << (friUnpacker_p->GetCacheKey() >> 4)
00212                     << ", copyID " <<  (friUnpacker_p->GetCacheKey() & 15)
00213                     << endl);        
00214                     
00215                 if (   a_friInfo.medVolNum != (Int32_t)friUnpacker_p->GetMedVolNum()
00216                     || a_friInfo.mediaKey  != friUnpacker_p->GetMediumKey() ) {
00217                     log_ERR_m("Same FRI-block object but different medium." << endl
00218                             << "Probably missing FRIEnd by previous split." << endl
00219                             << "FRI unpacker will be removed and new is created." << endl
00220                             << a_friInfo
00221                             << (*friUnpacker_p)
00222                             << "a_friBlock : " << cmn_HexDump(a_friBlock.get_buffer(), 
00223                                                               blockSize > 1024 ? 1024 : blockSize, 
00224                                                               16, 
00225                                                               true));
00226                             
00227                     m_friBlockUnpackerCache.RemoveEl(friUnpacker_p);
00228                     friUnpacker_p = new fsc_FRIblockUnpacker(key, 
00229                                                             m_dataLMgr, 
00230                                                             // dataL cache size
00231                                                             // average size of FRI file size is 512 bytes
00232                                                             blockSize >> 9,
00233                                                             a_friInfo.medVolNum,
00234                                                             a_friInfo.mediaKey,
00235                                                             blockSize);
00236                     m_friBlockUnpackerCache.Insert(friUnpacker_p);                            
00237                 }
00238             }
00239 
00240             g_DataLcache.Resize(blockSize >> 9); // 512 is average size of split in FRI
00241 //            friUnpacker_p->SetNewDataBlock();
00242             try {
00243                 const UInt8_t* block_p = reinterpret_cast<const UInt8_t*>(a_friBlock.get_buffer());
00244                 if (friUnpacker_p->Unpack(block_p, 0) == rec_FRIEnd_c) {
00245                     // @todo lock each fileID in block!
00246                     log_DBG_m(dbg_DETAIL, "Remove fsc_FRIblockUnpacker, Key = "
00247                         << " migID " << (friUnpacker_p->GetCacheKey() >> 4)
00248                         << ", copyID " <<  (friUnpacker_p->GetCacheKey() & 15)
00249                         << endl);
00250                     m_friBlockUnpackerCache.RemoveEl(friUnpacker_p);
00251                 }
00252             }
00253             catch (ivd_DFError e) {
00254                 if (  e.GetError() == ie_DF_INVSEQ
00255                    && friUnpacker_p->GetPrevRecType() == rec_ExpectFRIStart_c) {
00256                     log_ERR_m("New FRI unpacker, but it does not start with FRI-start record." << endl
00257                             << "No FSC update. Migration is probably aborted." << endl
00258                             << a_friInfo
00259                             << (*friUnpacker_p)
00260                             << "a_friBlock : " << cmn_HexDump(a_friBlock.get_buffer(), 
00261                                                               blockSize > 1024 ? 1024 : blockSize, 
00262                                                               16, 
00263                                                               true));
00264                     m_friBlockUnpackerCache.RemoveEl(friUnpacker_p);
00265                 }
00266                 throw;
00267             }
00268 
00269             vector<UInt64_t> minorColIds = friUnpacker_p->GetMinorCollocationIds();
00270             UInt32_t numColIds(minorColIds.size());
00271             collocationIds->length(numColIds);
00272             for (UInt32_t i(0); i < numColIds; i++) {
00273                 collocationIds[i] = minorColIds[i];
00274             }
00275         } // block where m_friBlockUnpackerCache_x is locked
00276         
00277         // @todo unlock each fileID at end of block handling!
00278         m_dataLMgr.FlushChangesAndCleanCache();
00279 
00280         return collocationIds._retn();
00281     }
00282     ipc_CATCH_IVD_THROW_CORBA_m;
00283 
00284 }

Here is the call graph for this function:

void i_FSC_i::CompleteMigration ( ivd_MigrationID_t  a_migrationID,
UInt32_t  a_copies 
)

Definition at line 287 of file i_FSC_impl.cpp.

References stx_CacheVec::Get(), fsc_FRIblockUnpacker::KeyGen(), log_ERR_m, log_FUNC_A_m, m_friBlockUnpackerCache, m_friBlockUnpackerCache_x, NULL, and stx_CacheVec::RemoveEl().

Referenced by pm_JobMgr::Migrate().

00287                                                                                   {
00288     log_FUNC_A_m(CompleteMigration, " migID : " << a_migrationID << ", copies : " << a_copies);
00289     
00290     cmn_MutexLock l(m_friBlockUnpackerCache_x);
00291     for (UInt32_t copyIdx = 0; copyIdx < a_copies; ++copyIdx) {
00292         stx_CacheKey_t key = fsc_FRIblockUnpacker::KeyGen(a_migrationID, copyIdx);
00293         fsc_FRIblockUnpacker* friUnpacker_p 
00294             = dynamic_cast<fsc_FRIblockUnpacker*>(m_friBlockUnpackerCache.Get(key));
00295         if (friUnpacker_p != NULL) {
00296             log_ERR_m("Remove orphaned fsc_FRIblockUnpacker," << endl
00297                 << "Key : ( "
00298                 << " migID : " << a_migrationID
00299                 << ", copyID : " <<  copyIdx << " )," << endl
00300                 << "friUnpacker_p : ( " << (*friUnpacker_p)
00301                 << " )" << endl);
00302             m_friBlockUnpackerCache.RemoveEl(friUnpacker_p);
00303         }
00304     }
00305 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_FileIDs_t * i_FSC_i::GetFileIDs ( i_Count_t  a_count  ) 

Definition at line 308 of file i_FSC_impl.cpp.

References dbg_NORM, fsc_DataLMgr::GetBunchOfFileIDs(), fio_DataBase::GetTransObj(), ipc_CATCH_IVD_THROW_CORBA_m, log_DBG_m, log_FUNC_m, m_dataLMgr, m_fscDB, fio_DataBase::ReleaseTransObj(), and size.

00308                                                  {
00309     log_FUNC_m(GetFileIDs);
00310 
00311     log_DBG_m(dbg_NORM, "GetFileIDs(" << a_count << ")");
00312 
00313     try {
00314         fsc_FileID_v_t fileIDvec;
00315 
00316         fio_Transaction *trans_p = m_fscDB.GetTransObj();
00317         m_dataLMgr.GetBunchOfFileIDs(fileIDvec, a_count, *trans_p);
00318         m_fscDB.ReleaseTransObj(&trans_p);
00319 
00320         int size = fileIDvec.size();
00321         i_FileIDs_t *fileIDs = new i_FileIDs_t(a_count);  // max space
00322         fileIDs->length(size);  // used space
00323         if ( size > 0 ) { 
00324             fsc_FileID_v_i iter = fileIDvec.begin();
00325             for (int i = 0; i < size; i++, iter++ ) {
00326                  (*fileIDs)[i] = *iter;
00327             }
00328         } 
00329         return fileIDs;
00330     }
00331     ipc_CATCH_IVD_THROW_CORBA_m;
00332 }

Here is the call graph for this function:

i_CopiesPos_v_t * i_FSC_i::GetCopiesPos ( i_FileID_t  a_fileID,
i_MigID_t a_migID,
i_FileSize_t  a_fileSize 
)

Definition at line 336 of file i_FSC_impl.cpp.

References ivd_MediaPos_t::blockOffset, i_MediumPos_t::blockOffset, cmn_Num2Str(), ivd_MediaPos_t::dataType, i_MediumPos_t::dataType, dbg_LOW, dbg_NORM, fsc_DataLMgr::GetCopiesPos(), ipc_CATCH_IVD_THROW_CORBA_m, log_DBG_m, log_FUNC_m, log_WRN_m, ipc_Log::LogCopiesPosition(), m_dataLMgr, ivd_MediaPos_t::mediaKey, i_MediumPos_t::mediumKey, ivd_MediaPos_t::medVolNum, i_MediumPos_t::medVolNum, ivd_MediaPos_t::splitOffset, i_MediumPos_t::splitOffset, ivd_MediaPos_t::splitSize, and i_MediumPos_t::splitSize.

00338                                                                 {
00339     log_FUNC_m(GetCopiesPos);
00340     
00341     try {
00342         log_DBG_m(dbg_NORM, "GetCopiesPos( FileID = " << a_fileID 
00343                          << ", MigID = " << a_migID 
00344                          << ", fileSize = " << a_fileSize << ")");
00345         ivd_CopiesPos_v_t copiesPos_v;
00346         
00347         m_dataLMgr.GetCopiesPos(
00348             copiesPos_v,
00349             a_fileID,
00350             static_cast<ivd_MigrationID_t&>(a_migID),
00351             a_fileSize);
00352 
00353         int copyNo = copiesPos_v.size();
00354 
00355         if (copyNo == 0) {
00356             string s("Wrong argument or Error. fileID=" 
00357                 + cmn_Num2Str((Int32_t)a_fileID) 
00358                 + " MigID=" + cmn_Num2Str(a_migID));
00359             log_WRN_m(s);
00360         }        
00361 
00362         i_CopiesPos_v_t *copies_v = new i_CopiesPos_v_t(copyNo);  // max space
00363 
00364         copies_v->length(copyNo);  // used space
00365 
00366         for (int c = 0; c < copyNo; c++) {
00367             ivd_MediaPos_v_t &medPos_v = copiesPos_v[c];
00368         
00369             int splitNo = medPos_v.size();
00370     //        i_MediumPos_v_t *medium_v = new i_MediumPos_v_t(splitNo);  // max space
00371             i_MediumPos_v_t &medium_v = (*copies_v)[c];
00372             medium_v.length(splitNo);
00373         
00374             for (int s = 0; s < splitNo; s++) {
00375                 ivd_MediaPos_t &medPos = medPos_v[s];
00376                 i_MediumPos_t   &medium  = medium_v[s];
00377                 medium.dataType    = medPos.dataType;
00378                 medium.mediumKey   = medPos.mediaKey;
00379                 medium.medVolNum   = medPos.medVolNum;
00380 
00381                 medium.blockOffset = medPos.blockOffset;
00382                 medium.splitSize   = medPos.splitSize;
00383                 medium.splitOffset = medPos.splitOffset;
00384 
00385             }
00386         }
00387 //        try {
00388             log_DBG_m(dbg_LOW,ipc_Log::LogCopiesPosition(*copies_v));
00389 //        } CATCH_CORBA_DETAIL_EXCEPTION
00390         
00391         return copies_v;
00392     }
00393     ipc_CATCH_IVD_THROW_CORBA_m;
00394 }

Here is the call graph for this function:

i_FSCfileState_v_t * i_FSC_i::CheckWithIVDFS ( const i_IvdfsFileInfo_v_t a_ivdfsFileInfo  ) 

Definition at line 398 of file i_FSC_impl.cpp.

References i_FSCfileState_t::arrayIdx, i_FSCNumCopVsNumPoolsCheckStatus_t::changed, fsc_DataLMgr::CheckLastGen(), dbg_DETAIL, i_IvdfsFileInfo_t::fileName, i_FSCfileState_t::fileState, i_FSCfileState_t::fscNumCopVsNumPoolsCheckStatus, ipc_Init::InitFSCFileState(), ipc_CATCH_IVD_THROW_CORBA_m, log_DBG_m, log_FUNC_m, m_dataLMgr, m_ms, m_numPools, and i_FSCfileState_t::migrationID.

00398                                                                                       {
00399     log_FUNC_m(CheckWithIVDFS);
00400     try {
00401         vector<i_FSCfileState_t> result;
00402         unsigned int i;
00403         string retStatus;
00404         for (i = 0; i < a_ivdfsFileInfo.length(); i++) {
00405             ivd_MigrationID_t migID = 0;
00406             const i_IvdfsFileInfo_t &ivdFSfileInfo = a_ivdfsFileInfo[i];
00407 
00408             i_FSCfileState_t state;
00409             ipc_Init::InitFSCFileState(state);
00410 
00411             m_dataLMgr.CheckLastGen(retStatus,
00412                                     state,
00413                                     ivdFSfileInfo,
00414                                     migID,
00415                                     m_numPools,
00416                                     m_ms);
00417             if (!retStatus.empty() || state.fscNumCopVsNumPoolsCheckStatus.changed) {
00418                 if (!retStatus.empty()) {
00419                     retStatus.resize(retStatus.size() - 1); // remove one new-line
00420                 }
00421                 log_DBG_m(dbg_DETAIL, "FS-FSC CHK mismatch: file " << ivdFSfileInfo.fileName
00422                     << " description: " << retStatus);
00423                 state.arrayIdx  = i;
00424                 state.migrationID = migID;
00425                 state.fileState = CORBA::string_dup(retStatus.c_str());
00426                 result.push_back(state);
00427                 retStatus.clear();
00428             }
00429         }
00430 
00431         i_FSCfileState_v_t *fileState_v = new i_FSCfileState_v_t(result.size());  // max space
00432         fileState_v->length(result.size());  // used space
00433         for (i = 0; i < result.size(); i++) {
00434             (*fileState_v)[i] = result[i];
00435         }
00436         return fileState_v;
00437     }
00438     ipc_CATCH_IVD_THROW_CORBA_m;
00439 }

Here is the call graph for this function:

i_FileHistoryList_t * i_FSC_i::GetFileHistory ( i_FileID_t  a_fileID  ) 

Definition at line 691 of file i_FSC_impl.cpp.

References i_FileHistory_t::dataType, i_FileHistory_t::fileName, i_FileHistory_t::fileSize, fsc_DataLMgr::GetHistory(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, m_dataLMgr, and i_FileHistory_t::migrationID.

00691                                                                {
00692     log_FUNC_m(GetFileHistory);
00693 
00694     try {
00695     
00696         fsc_GenIDsize_v generations;
00697         // the generations vector will be fill up with generations
00698         ivd_MigrationID_t nscMigID(0);
00699         string filePath("n/a");
00700         
00701         m_dataLMgr.GetHistory(a_fileID, generations, nscMigID, filePath);
00702 
00703         i_FileHistoryList_t_var fhl = new i_FileHistoryList_t;
00704         fhl->length(generations.size());
00705         for (UInt32_t i(0); i < fhl->length(); i++) {
00706             i_FileHistory_t & hist = fhl[i];
00707             hist.migrationID = generations[i].migID;
00708             hist.fileSize    = generations[i].fileSize;
00709             hist.dataType    = generations[i].dataType;
00710             if (nscMigID == hist.migrationID) {
00711                 hist.fileName = CORBA::string_dup(filePath.c_str());
00712             }
00713             else {
00714                 hist.fileName = CORBA::string_dup("n/a");
00715             }
00716         }
00717         return fhl._retn();
00718     } ipc_CATCH_IVD_THROW_CORBA_m  
00719 }

Here is the call graph for this function:

i_FileID_t i_FSC_i::ChkLastFileID ( i_FileID_t  a_fileID  ) 

Definition at line 722 of file i_FSC_impl.cpp.

References dbg_DETAIL, fio_RelFile::FirstNewIDX(), g_dataLRF_p, fio_DataBase::GetTransObj(), log_DBG_m, log_FUNC_m, log_NOTE_m, log_WriteEvent(), m_fscDB, fio_DataBase::ReleaseTransObj(), fio_Transaction::StartTransaction(), and fio_RelFile::WriteRec().

00722                                                      {
00723     log_FUNC_m(ChkLastFileID);
00724     // expand DataL file to use greater fileID
00725     ivd_RecordIDX_t fscMaxFileID = g_dataLRF_p->FirstNewIDX();
00726     if (fscMaxFileID <= a_fileID) {
00727         ostringstream sstr;
00728         sstr << "Max fileID updated. Previous max fileID = " << fscMaxFileID
00729              << " Updated to HSMDB max fileID = " << a_fileID;// << 
00730         log_NOTE_m(sstr.str());
00731         log_DBG_m(dbg_DETAIL, sstr.str());
00732         log_WriteEvent(sstr.str(), "HSM-REGISTER");
00733 
00734         fio_Transaction *trans = m_fscDB.GetTransObj();
00735         trans->StartTransaction();
00736         fsc_DataL_t dataL; // an empty record
00737         g_dataLRF_p->WriteRec(a_fileID, &dataL, 1, trans);
00738         trans->EndTransaction();
00739         m_fscDB.ReleaseTransObj(&trans);
00740     }
00741     return fscMaxFileID - 1;
00742 }

Here is the call graph for this function:

void i_FSC_i::ReleaseVolEntries ( i_DBKey_t  a_mediumKey,
i_Index_t  a_medVolNum 
)

Definition at line 745 of file i_FSC_impl.cpp.

References log_FUNC_m, log_WriteEvent(), m_dataLMgr, m_partitionName, m_reorgScanRelease_x, and fsc_DataLMgr::Remove().

Referenced by i_ReorgJob_i::InitializeVolumes(), and i_PartitionManager_i::ReleaseVolEntries().

00746                                                        {
00747     log_FUNC_m(ReleaseVolEntries);
00748     cmn_MutexLock l(m_reorgScanRelease_x);
00749     ostringstream sstr;
00750     sstr << " Start releasing entries from medium " << a_mediumKey 
00751          << ", volume " << a_medVolNum
00752          << " on partition " << m_partitionName;
00753     log_WriteEvent(sstr.str(), "Reorg");
00754     m_dataLMgr.Remove(m_partitionName, a_mediumKey, a_medVolNum);
00755 }

Here is the call graph for this function:

Here is the caller graph for this function:

i_Status_t i_FSC_i::Suspend ( void   ) 

Definition at line 452 of file i_FSC_impl.cpp.

References evt_ERROR, log_FUNC_m, log_WriteEvent(), m_fscDB, and fio_DataBase::Suspend().

00452                             {
00453     log_FUNC_m(Suspend);
00454     try {
00455         m_fscDB.Suspend();
00456         log_WriteEvent("FSC suspend successful.", "FSC");
00457         return 0;
00458     }
00459     catch (...) {
00460         log_WriteEvent(evt_ERROR, "FSC suspend failed.", "FSC");        
00461         return 1;
00462     }
00463 }

Here is the call graph for this function:

void i_FSC_i::Continue ( i_Status_t  a_status  ) 

Definition at line 467 of file i_FSC_impl.cpp.

References fio_DataBase::Continue(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, log_WriteEvent(), and m_fscDB.

00467                                           {
00468     log_FUNC_m(Continue);
00469     try {
00470         m_fscDB.Continue(a_status);
00471         log_WriteEvent("FSC continue successful.", "FSC");
00472     }
00473     ipc_CATCH_IVD_THROW_CORBA_m;
00474 }

Here is the call graph for this function:

void i_FSC_i::FSCRecovery ( const string &  a_medVolIDstr,
ivd_MedVolNum_t  a_medVolNum,
ivd_MediaKey_t  a_mediaKey,
UInt32_t  a_blkSize,
UInt32_t  a_lastDataPosition 
)

FSCRecovery method is called to reaplly the FSC from FRI file the file must be locatted on /var/opt/ivd/tmp storen in global var g_cmn.dirs.tmp In case of wrong FRI format an ivd_DFError() exception is returned.

DFError return number of blocks after last good block header read. It's useful for direct tape read.

Definition at line 478 of file i_FSC_impl.cpp.

References bbt_DISK_FRI_RECOVERY, blk_FRI_c, fsc_DataLMgr::FlushChangesAndCleanCache(), fsc_FRIunpacker::GetSplitCount(), log_FUNC_m, log_WriteEvent(), m_dataLMgr, m_recoveryInProgress_x, cmn_Thread::Start(), and df_RecReader::Unpack().

Referenced by i_PartitionManager_i::FSCRecovery().

00483                                              {
00484 
00485     log_FUNC_m(FSCRecovery);
00486     // only one at a time
00487     cmn_MutexLock l(m_recoveryInProgress_x);
00488 
00489     /* cacheSize is in relation with transaction size. 
00490        See fsc_FRIunpacker::ProcSplitInfo()
00491        Recovery cache size = 2 * (cacheSize * sizeof(df_SplitInfo)) 
00492                            = 2 * (10240     * 128B)
00493                            = 2.5MB
00494     */
00495     const UInt32_t    cacheSize = 10240; 
00496 
00497     const bool        recovery = true;
00498 
00499     ostringstream sstr;
00500     sstr << "Started FSC recover for volume: " << a_medVolIDstr;
00501     log_WriteEvent(sstr.str(), "RECOVERY");
00502 
00503 //    m_dataLMgr.StartTransaction();
00504 
00505     df_BlockReader *blockReader_p = new df_BlockReader(blk_FRI_c, bbt_DISK_FRI_RECOVERY, a_blkSize);
00506     fsc_FRIunpacker fscRecoverer(
00507          m_dataLMgr,
00508          cacheSize,
00509          a_medVolNum,
00510          a_mediumKey,
00511          blockReader_p);
00512 
00513     blk_DiskFRIReader *fri_p =
00514         new blk_DiskFRIReader(blockReader_p->GetMgr(), a_medVolIDstr, recovery);
00515 
00516     fri_p->Start(); // start filling buffer
00517 
00518     try {
00519         fscRecoverer.Unpack(); // start reading buffer and filling FSC
00520         ostringstream sstr;
00521         sstr << "Finished FSC recover for volume: " << a_medVolIDstr << 
00522                 "(splits: " << fscRecoverer.GetSplitCount() << ").";
00523         log_WriteEvent(sstr.str(), "RECOVERY");
00524     }
00525     catch (...) {
00526         ostringstream sstr;
00527         sstr << "ABORT! FSC recover for volume: " << a_medVolIDstr << 
00528                 "(at split: " << fscRecoverer.GetSplitCount() << ").";
00529         log_WriteEvent(sstr.str(), "RECOVERY");
00530 //        m_dataLMgr.AbortTransaction();
00531         throw;
00532     }
00533 
00534     m_dataLMgr.FlushChangesAndCleanCache();
00535 
00536 //    m_dataLMgr.EndTransaction();
00537 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_FSC_i::CollectByVolume (  ) 

Collect by volume scan through FSC and store each split to medVolOfs files.

See also:
fsc_MedVolume

Definition at line 540 of file i_FSC_impl.cpp.

References log_FUNC_m, m_fscPath, and fsc_RawScan::ScanAllFileID().

Referenced by i_MediumCheckJob_i::Execute().

00540                               {
00541     log_FUNC_m(CollectByVolume);
00542         
00543     fsc_RawMedVolCollector collectByVol(m_fscPath);
00544     fsc_RawScan fscScan(false, collectByVol);
00545     fscScan.ScanAllFileID();
00546 }

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_ScanInfo_v_t & i_FSC_i::ReorgScan ( ivd_Time32_t  a_expDate,
UInt32_t  a_numGener 
)

Scan through FSC to collect data for reorganization.

Return the reference to vector of medium volume size info.

Definition at line 549 of file i_FSC_impl.cpp.

References g_fscScanInfo, log_FUNC_m, m_partitionName, m_reorgScanRelease_x, and fsc_RawScan::ScanAllFileID().

Referenced by i_ReorgScanJob_i::Execute().

00550                                                                {
00551     log_FUNC_m(ReorgScan);
00552 
00553     cmn_MutexLock l(m_reorgScanRelease_x);
00554     g_fscScanInfo.clear();
00555     fsc_RawReorgScanDataCollector collectForReorg(m_partitionName, a_expDate, a_numGener);
00556     fsc_RawScan fscScan(false, collectForReorg);
00557     fscScan.ScanAllFileID();
00558     return g_fscScanInfo;
00559 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_FSC_i::DelExpiredFiles ( ui_MsgWriter a_msgw,
i_HSM_ptr  a_ihsm,
fsc_FileExpiration a_fileExp,
char  a_clientPathSeparator 
)

Definition at line 562 of file i_FSC_impl.cpp.

References fsc_RawScan::DirTreeWalk(), ui_MsgWriter::DisplayMessage(), and log_FUNC_m.

Referenced by i_DelExpiredFilesJob_i::Execute().

00565                                                                          {
00566     log_FUNC_m(DelExpiredFiles);
00567     fsc_ColectorExpFile collectorForDelExpFiles(a_msgw, a_ihsm, a_fileExp, a_clientPathSeparator);
00568     fsc_RawScan fscScan(false, collectorForDelExpFiles, a_clientPathSeparator);
00569     a_msgw.DisplayMessage("Scanning for expired files...");
00570     fscScan.DirTreeWalk(0, string("")); // Scan from mount point
00571 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_FSC_i::RedundantCopy ( fsc_RedunCopyResult_v a_results,
vector< UInt32_t > &  a_unavailFilesPerVol,
fsc_MediumStatus_v a_medStat,
ivd_MediaKey_t  a_origMedKey,
vector< UInt32_t a_origMedVol,
bool  a_best_effort 
)

Definition at line 574 of file i_FSC_impl.cpp.

References cfg_MEGABYTE, dbg_DETAIL, log_DBG_m, log_FUNC_m, and fsc_RawScan::ScanAllFileID().

Referenced by i_RedundantCopyJob_i::Prepare().

00579                                                                   {
00580     log_FUNC_m(RedundantCopy);
00581 
00582     { // NOTE! must be in block, because of collection gresult in destructos
00583         log_DBG_m(dbg_DETAIL, "Before fsc_CollectorRedunCopy CTOR " << a_origMedVol.size() );
00584         fsc_CollectorRedunCopy redCopy( a_results,
00585                                         a_unavailFilesPerVol, 
00586                                         a_medStat, 
00587                                         a_origMedKey,
00588                                         a_origMedVol,
00589                                         a_best_effort);
00590         
00591         fsc_RawScan fscScan(false, redCopy);
00592         fscScan.ScanAllFileID();
00593     }
00594     sort(a_results.begin(), a_results.end());
00595     
00596     ostringstream sstr;
00597     sstr << " Used media for redundant copy of media " << a_origMedKey << endl
00598          << " MediumKey VolNum      DataSize" << endl
00599          << "===============================";
00600     fsc_RedunCopyResult_v_i iter = a_results.begin();
00601     for (; iter != a_results.end(); ++iter) {
00602         iter->buffSize = iter->buffSize/cfg_MEGABYTE + 1;
00603         sstr << endl
00604              << setw(10) << iter->mediumKey 
00605              << setw( 7) << iter->medVolNum
00606              << setw(14) << iter->buffSize;
00607     }
00608     log_DBG_m(dbg_DETAIL, sstr.str());
00609 
00610 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_FSC_i::DeleteEntries ( ivd_MediaKey_t  a_medKey,
vector< UInt32_t a_medVols 
)

Definition at line 613 of file i_FSC_impl.cpp.

References log_FUNC_m, m_dataLMgr, and fsc_RawScan::ScanAllFileID().

Referenced by i_RedundantCopyJob_i::~i_RedundantCopyJob_i().

00614                                                               {
00615     log_FUNC_m(DeleteEntries);
00616 
00617     { // NOTE! must be in block, because of collection gresult in destructos
00618         
00619         fsc_CollectorDelete delCollector( a_medKey,
00620                                           a_medVols,
00621                                           m_dataLMgr);
00622         
00623         fsc_RawScan fscScan(false, delCollector);
00624         fscScan.ScanAllFileID();
00625     }
00626 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_FSC_i::CheckWithMedVolume ( const string &  a_medVolIDstr,
ivd_MedVolNum_t  a_medVolNum,
const string &  a_mediumBarCode,
ivd_MediaKey_t  a_mediaKey,
UInt32_t  a_blkSize,
const string &  a_partitionName,
bool  a_autoCorrect,
bool  a_removeMissingOnMedia,
ui_MsgWriter a_msgWrite,
ivd_MediaChkStat_t a_totalChkStat,
UInt32_t  a_lastDataPosition 
)

Definition at line 630 of file i_FSC_impl.cpp.

References bbt_DISK_FRI_RECOVERY, blk_FRI_c, ui_MsgWriter::DisplayMessage(), df_BlockReader::GetMgr(), log_FUNC_m, m_dataLMgr, m_fscPath, m_mediaCheckRun_x, cmn_Thread::Start(), and df_RecReader::Unpack().

Referenced by i_MediumCheckJob_i::ProcessFRI().

00641                                                   {
00642 
00643     log_FUNC_m(CheckWithMedVolume);
00644 
00645     cmn_MutexLock l(m_mediaCheckRun_x);
00646 
00647     ostringstream sstr;
00648     sstr << "Started FSC chk " 
00649          << "vol num:" << setw(5) << a_medVolNum
00650          << ", medium: "   << a_mediumBarCode;
00651     
00652     a_msgWrite.DisplayMessage(sstr.str());
00653 
00654     ivd_MediaChkStat_t checkStat;
00655     {
00656         df_BlockReader *blockReader_p = new df_BlockReader(blk_FRI_c, bbt_DISK_FRI_RECOVERY, a_blkSize);
00657         fsc_VolumeCheck fscVolumeCheck(
00658             m_dataLMgr,
00659             m_fscPath,
00660             a_partitionName,
00661             a_medVolIDstr,
00662             a_msgWrite,
00663             a_medVolNum,
00664             a_mediumKey,
00665             blockReader_p,
00666             a_autoCorrect,
00667             a_removeMissingOnMedia,
00668             checkStat,
00669             a_lastDataPosition);
00670 
00671         blk_DiskFRIReader *fri_p =
00672             new blk_DiskFRIReader(blockReader_p->GetMgr(), a_medVolIDstr, true);
00673 
00674         fri_p->Start(); // start filling buffer
00675 
00676         try {
00677             fscVolumeCheck.Unpack(); // start reading buffer and filling FSC
00678         }
00679         catch (...) {
00680             throw;
00681         }
00682     } // fsc_VolumeCheck has to call destructor to fullfill the statistic.
00683     a_totalChkStat += checkStat;
00684     ostringstream sstrEnd;
00685     sstrEnd << "Finished FSC check (medium: " << a_mediumBarCode 
00686         << ", volume: " << a_medVolNum << "):"
00687         << checkStat;
00688     a_msgWrite.DisplayMessage(sstrEnd.str());
00689 }

Here is the call graph for this function:

Here is the caller graph for this function:

UInt32_t i_FSC_i::GetNumOfUsedFileID (  )  [inline]

Definition at line 164 of file i_FSC_impl.h.

00164 { return m_dataLMgr.GetNumOfUsedFileID(); };

void i_FSC_i::IVDFSRecovery ( const string &  a_partitionName,
i_HSM_ptr  a_ihsm,
ui_MsgWriter a_uims 
)

Definition at line 758 of file i_FSC_impl.cpp.

References dbg_DETAIL, ui_MsgWriter::DisplayMessage(), cmn_Mutex::Lock(), log_DBG_m, log_FUNC_m, m_IVDFSRecoveryAbort, m_IVDFSRecoveryRun, m_recoveryInProgress_x, nsc_ScanForIVDFSRecovery(), and cmn_Mutex::Unlock().

Referenced by i_RecreatedIVDFSJob_i::Execute().

00760                                                           {
00761     log_FUNC_m(IVDFSRecovery);
00762     /*ui_MsgWriter msgWriter(g_cmn.dirs.log + 
00763                           ( string("hsmfs_recovery_") + a_partitionName + string(".log")),
00764                           a_uims, false);
00765 */
00766     log_DBG_m(dbg_DETAIL, "m_IVDFSRecoveryRun = " << m_IVDFSRecoveryRun);
00767     log_DBG_m(dbg_DETAIL, "m_IVDFSRecoveryAbort = " << m_IVDFSRecoveryAbort);
00768     m_recoveryInProgress_x.Lock();
00769     if (m_IVDFSRecoveryRun) { 
00770         a_uims.DisplayMessage("HSMFS recovery already run.");
00771         return;
00772     }
00773     m_IVDFSRecoveryRun   = true;
00774     m_IVDFSRecoveryAbort = false;
00775     m_recoveryInProgress_x.Unlock();
00776 
00777     try {
00778         nsc_ScanForIVDFSRecovery(a_partitionName, a_ihsm, a_uims, m_IVDFSRecoveryAbort);
00779     }
00780     catch (ivd_Exception ) {
00781         cmn_MutexLock l(m_recoveryInProgress_x);
00782         m_IVDFSRecoveryRun   = false;
00783         m_IVDFSRecoveryAbort = false;
00784         throw;
00785     }
00786 
00787     cmn_MutexLock l(m_recoveryInProgress_x);
00788     m_IVDFSRecoveryRun   = false;
00789     m_IVDFSRecoveryAbort = false;
00790 }

Here is the call graph for this function:

Here is the caller graph for this function:

void i_FSC_i::IVDFSRecoveryAbort (  ) 

Definition at line 793 of file i_FSC_impl.cpp.

References log_FUNC_m, log_WriteEvent(), m_IVDFSRecoveryAbort, m_IVDFSRecoveryRun, and m_recoveryInProgress_x.

Referenced by i_RecreatedIVDFSJob_i::AbortJob().

00793                                  {
00794     log_FUNC_m(IVDFSRecoveryAbort);
00795     cmn_MutexLock l(m_recoveryInProgress_x);
00796     ostringstream sstr;
00797     if (!m_IVDFSRecoveryRun) {
00798         sstr << "Can't Abort. HSMFS recovery not running."; // << 
00799         log_WriteEvent(sstr.str(), "RECOVERY");
00800         return;
00801     }
00802     sstr << "Ask for abort."; // << 
00803     log_WriteEvent(sstr.str(), "RECOVERY");
00804     m_IVDFSRecoveryAbort = true;    
00805 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool i_FSC_i::IsIVDFSRecoveryRun (  )  [inline]

Definition at line 172 of file i_FSC_impl.h.

00172 { return m_IVDFSRecoveryRun; };

cmn_Path i_FSC_i::GetFscPath (  )  [inline]

Definition at line 173 of file i_FSC_impl.h.

00173 { return m_fscPath;};

void i_FSC_i::SetMediumStatusMember ( fsc_MediumStatus_v ms  )  [inline]

Definition at line 175 of file i_FSC_impl.h.

Referenced by i_PartitionManager_i::CheckFSCvsIVDFS().

00175 { m_ms = ms;};

Here is the caller graph for this function:

void i_FSC_i::EfficientRecallGetLocations ( i_RecallList_t a_recallList,
fsc_MediumStatus_v a_medStat,
fsc_FileLocStorage a_fileLocStorage 
)

Definition at line 808 of file i_FSC_impl.cpp.

References i_Recall_t::fileID, i_Recall_t::fileSize, fsc_DataLMgr::GetCopiesPos(), ipc_CATCH_IVD_THROW_CORBA_m, log_FUNC_m, m_dataLMgr, and i_Recall_t::migrationID.

00810                                                                                 {
00811     log_FUNC_m(EfficientRecallGetLocations);
00812     
00813     try {
00814         for (UInt32_t i = 0; i < a_recallList.length(); ++i) {
00815             i_Recall_t &recInfo = a_recallList[i];
00816 
00817             ivd_CopiesPos_v_t copiesPos_v;
00818             
00819             m_dataLMgr.GetCopiesPos(
00820                 copiesPos_v,
00821                 recInfo.fileID,
00822                 recInfo.migrationID,
00823                 recInfo.fileSize);
00824         }
00825     }
00826     ipc_CATCH_IVD_THROW_CORBA_m;    
00827 }

Here is the call graph for this function:


Member Data Documentation

const string i_FSC_i::m_partitionName [private]

Definition at line 46 of file i_FSC_impl.h.

Referenced by ReleaseVolEntries(), and ReorgScan().

const cmn_Path i_FSC_i::m_fscPath [private]

Definition at line 48 of file i_FSC_impl.h.

Referenced by CheckWithMedVolume(), and CollectByVolume().

Definition at line 50 of file i_FSC_impl.h.

Definition at line 51 of file i_FSC_impl.h.

Referenced by ChkLastFileID(), Continue(), GetFileIDs(), and Suspend().

bool& i_FSC_i::m_down [private]

Definition at line 53 of file i_FSC_impl.h.

Referenced by i_FSC_i(), and ~i_FSC_i().

Definition at line 55 of file i_FSC_impl.h.

Referenced by FSCRecovery(), IVDFSRecovery(), and IVDFSRecoveryAbort().

Definition at line 56 of file i_FSC_impl.h.

Referenced by IVDFSRecovery(), and IVDFSRecoveryAbort().

Definition at line 57 of file i_FSC_impl.h.

Referenced by IVDFSRecovery(), and IVDFSRecoveryAbort().

Definition at line 59 of file i_FSC_impl.h.

Referenced by CheckWithMedVolume().

bool i_FSC_i::m_mediaCheckRun [private]

Definition at line 60 of file i_FSC_impl.h.

Only reorg scan or release volume could run at same time.

Definition at line 63 of file i_FSC_impl.h.

Referenced by ReleaseVolEntries(), and ReorgScan().

cache that hold current active fsc_FRIblockUnpacker objects it's a vector of pointers to fsc_FRIblockUnpacker It's expected only few active unpackers at same time.

Definition at line 69 of file i_FSC_impl.h.

Referenced by CompleteMigration(), and InsertSplitFromFRIBlock().

Definition at line 70 of file i_FSC_impl.h.

Referenced by CompleteMigration(), and InsertSplitFromFRIBlock().

Definition at line 72 of file i_FSC_impl.h.

Referenced by CheckWithIVDFS().

Definition at line 76 of file i_FSC_impl.h.

Referenced by CheckWithIVDFS().

Reimplemented from i_Component_i.

Definition at line 180 of file i_FSC_impl.h.


The documentation for this class was generated from the following files:

Generated on Mon Feb 27 19:32:31 2012 for OPENARCHIVE by  doxygen 1.5.6