Public Member Functions | Public Attributes | Private Attributes

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.

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

Detailed Description

Definition at line 51 of file i_FSC_impl.h.


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 79 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.

        :
        m_partitionName(a_partitionName),
        m_fscPath(fsc_GetDir(a_partitionName)),
        m_fscFiles(new fsc_Files(m_fscPath, false)), // no read only mode (read-write)
        m_fscDB(a_dbID, m_fscPath, m_fscFiles),
        m_dataLMgr(m_fscDB.GetTransObj()),
        m_down(a_down),
        m_IVDFSRecoveryRun(false),
        m_IVDFSRecoveryAbort(false),
        m_mediaCheckRun(false),
        m_numPools(a_numPools)
{
    log_FUNC_m(i_FSC_i);
    m_down = false;

    string sNoNSC = cmn_GetEnvVariable(fsc_noNSC_c);
    if (!sNoNSC.empty()) {
        g_updateNSC = false;
        ostringstream sstr;
        sstr << "NSC update is disabled. " 
                << fsc_noNSC_c 
                << " = " << sNoNSC
                << " Environment variable exist and it is not empty.";
        log_WriteEvent(sstr.str(), "FSC");
    }    
    g_fsLog.Init(a_partitionName);
}

Here is the call graph for this function:

i_FSC_i::~i_FSC_i (  )  [virtual]

Definition at line 113 of file i_FSC_impl.cpp.

References dbg_DETAIL, log_DBG_m, log_FUNC_m, and m_down.

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


Member Function Documentation

i_FSCfileState_v_t * i_FSC_i::CheckWithIVDFS ( const i_IvdfsFileInfo_v_t a_ivdfsFileInfo  ) 

Definition at line 412 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(), log_DBG_m, log_FUNC_m, m_dataLMgr, m_ms, m_numPools, and i_FSCfileState_t::migrationID.

                                                                                      {
    log_FUNC_m(CheckWithIVDFS);
    try {
        vector<i_FSCfileState_t> result;
        unsigned int i;
        string retStatus;
        for (i = 0; i < a_ivdfsFileInfo.length(); i++) {
            ivd_MigrationID_t migID = 0;
            const i_IvdfsFileInfo_t &ivdFSfileInfo = a_ivdfsFileInfo[i];

            i_FSCfileState_t state;
            ipc_Init::InitFSCFileState(state);

            m_dataLMgr.CheckLastGen(retStatus,
                                    state,
                                    ivdFSfileInfo,
                                    migID,
                                    m_numPools,
                                    m_ms);
            if (!retStatus.empty() || state.fscNumCopVsNumPoolsCheckStatus.changed) {
                if (!retStatus.empty()) {
                    retStatus.resize(retStatus.size() - 1); // remove one new-line
                }
                log_DBG_m(dbg_DETAIL, "FS-FSC CHK mismatch: file " << ivdFSfileInfo.fileName
                    << " description: " << retStatus);
                state.arrayIdx  = i;
                state.migrationID = migID;
                state.fileState = CORBA::string_dup(retStatus.c_str());
                result.push_back(state);
                retStatus.clear();
            }
        }

        i_FSCfileState_v_t *fileState_v = new i_FSCfileState_v_t(result.size());  // max space
        fileState_v->length(result.size());  // used space
        for (i = 0; i < result.size(); i++) {
            (*fileState_v)[i] = result[i];
        }
        return fileState_v;
    }
    ipc_CATCH_IVD_THROW_CORBA_m;
}

Here is the call 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 644 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().

                                                  {

    log_FUNC_m(CheckWithMedVolume);

    cmn_MutexLock l(m_mediaCheckRun_x);

    ostringstream sstr;
    sstr << "Started FSC chk " 
         << "vol num:" << setw(5) << a_medVolNum
         << ", medium: "   << a_mediumBarCode;
    
    a_msgWrite.DisplayMessage(sstr.str());

    ivd_MediaChkStat_t checkStat;
    {
        df_BlockReader *blockReader_p = new df_BlockReader(blk_FRI_c, bbt_DISK_FRI_RECOVERY, a_blkSize);
        fsc_VolumeCheck fscVolumeCheck(
            m_dataLMgr,
            m_fscPath,
            a_partitionName,
            a_medVolIDstr,
            a_msgWrite,
            a_medVolNum,
            a_mediumKey,
            blockReader_p,
            a_autoCorrect,
            a_removeMissingOnMedia,
            checkStat,
            a_lastDataPosition);

        blk_DiskFRIReader *fri_p =
            new blk_DiskFRIReader(blockReader_p->GetMgr(), a_medVolIDstr, true);

        fri_p->Start(); // start filling buffer

        try {
            fscVolumeCheck.Unpack(); // start reading buffer and filling FSC
        }
        catch (...) {
            throw;
        }
    } // fsc_VolumeCheck has to call destructor to fullfill the statistic.
    a_totalChkStat += checkStat;
    ostringstream sstrEnd;
    sstrEnd << "Finished FSC check (medium: " << a_mediumBarCode 
        << ", volume: " << a_medVolNum << "):"
        << checkStat;
    a_msgWrite.DisplayMessage(sstrEnd.str());
}

Here is the call graph for this function:

Here is the caller graph for this function:

i_FileID_t i_FSC_i::ChkLastFileID ( i_FileID_t  a_fileID  ) 

Definition at line 736 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().

                                                     {
    log_FUNC_m(ChkLastFileID);
    // expand DataL file to use greater fileID
    ivd_RecordIDX_t fscMaxFileID = g_dataLRF_p->FirstNewIDX();
    if (fscMaxFileID <= a_fileID) {
        ostringstream sstr;
        sstr << "Max fileID updated. Previous max fileID = " << fscMaxFileID
             << " Updated to HSMDB max fileID = " << a_fileID;// << 
        log_NOTE_m(sstr.str());
        log_DBG_m(dbg_DETAIL, sstr.str());
        log_WriteEvent(sstr.str(), "HSM-REGISTER");

        fio_Transaction *trans = m_fscDB.GetTransObj();
        trans->StartTransaction();
        fsc_DataL_t dataL; // an empty record
        g_dataLRF_p->WriteRec(a_fileID, &dataL, 1, trans);
        trans->EndTransaction();
        m_fscDB.ReleaseTransObj(&trans);
    }
    return fscMaxFileID - 1;
}

Here is the call 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 554 of file i_FSC_impl.cpp.

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

Referenced by i_MediumCheckJob_i::Execute().

                              {
    log_FUNC_m(CollectByVolume);
        
    fsc_RawMedVolCollector collectByVol(m_fscPath);
    fsc_RawScan fscScan(false, collectByVol);
    fscScan.ScanAllFileID();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 301 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().

                                                                                  {
    log_FUNC_A_m(CompleteMigration, " migID : " << a_migrationID << ", copies : " << a_copies);
    
    cmn_MutexLock l(m_friBlockUnpackerCache_x);
    for (UInt32_t copyIdx = 0; copyIdx < a_copies; ++copyIdx) {
        stx_CacheKey_t key = fsc_FRIblockUnpacker::KeyGen(a_migrationID, copyIdx);
        fsc_FRIblockUnpacker* friUnpacker_p 
            = dynamic_cast<fsc_FRIblockUnpacker*>(m_friBlockUnpackerCache.Get(key));
        if (friUnpacker_p != NULL) {
            log_ERR_m("Remove orphaned fsc_FRIblockUnpacker," << endl
                << "Key : ( "
                << " migID : " << a_migrationID
                << ", copyID : " <<  copyIdx << " )," << endl
                << "friUnpacker_p : ( " << (*friUnpacker_p)
                << " )" << endl);
            m_friBlockUnpackerCache.RemoveEl(friUnpacker_p);
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void i_FSC_i::Continue ( i_Status_t  a_status  ) 

Definition at line 481 of file i_FSC_impl.cpp.

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

                                          {
    log_FUNC_m(Continue);
    try {
        m_fscDB.Continue(a_status);
        log_WriteEvent("FSC continue successful.", "FSC");
    }
    ipc_CATCH_IVD_THROW_CORBA_m;
}

Here is the call graph for this function:

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

Definition at line 627 of file i_FSC_impl.cpp.

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

Referenced by i_RedundantCopyJob_i::~i_RedundantCopyJob_i().

                                                              {
    log_FUNC_m(DeleteEntries);

    { // NOTE! must be in block, because of collection gresult in destructos
        
        fsc_CollectorDelete delCollector( a_medKey,
                                          a_medVols,
                                          m_dataLMgr);
        
        fsc_RawScan fscScan(false, delCollector);
        fscScan.ScanAllFileID();
    }
}

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 576 of file i_FSC_impl.cpp.

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

Referenced by i_DelExpiredFilesJob_i::Execute().

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

Here is the call graph for this function:

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 822 of file i_FSC_impl.cpp.

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

                                                                                {
    log_FUNC_m(EfficientRecallGetLocations);
    
    try {
        for (UInt32_t i = 0; i < a_recallList.length(); ++i) {
            i_Recall_t &recInfo = a_recallList[i];

            ivd_CopiesPos_v_t copiesPos_v;
            
            m_dataLMgr.GetCopiesPos(
                copiesPos_v,
                recInfo.fileID,
                recInfo.migrationID,
                recInfo.fileSize);
        }
    }
    ipc_CATCH_IVD_THROW_CORBA_m;    
}

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 492 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().

                                             {

    log_FUNC_m(FSCRecovery);
    // only one at a time
    cmn_MutexLock l(m_recoveryInProgress_x);

    /* cacheSize is in relation with transaction size. 
       See fsc_FRIunpacker::ProcSplitInfo()
       Recovery cache size = 2 * (cacheSize * sizeof(df_SplitInfo)) 
                           = 2 * (10240     * 128B)
                           = 2.5MB
    */
    const UInt32_t    cacheSize = 10240; 

    const bool        recovery = true;

    ostringstream sstr;
    sstr << "Started FSC recover for volume: " << a_medVolIDstr;
    log_WriteEvent(sstr.str(), "RECOVERY");

//    m_dataLMgr.StartTransaction();

    df_BlockReader *blockReader_p = new df_BlockReader(blk_FRI_c, bbt_DISK_FRI_RECOVERY, a_blkSize);
    fsc_FRIunpacker fscRecoverer(
         m_dataLMgr,
         cacheSize,
         a_medVolNum,
         a_mediumKey,
         blockReader_p);

    blk_DiskFRIReader *fri_p =
        new blk_DiskFRIReader(blockReader_p->GetMgr(), a_medVolIDstr, recovery);

    fri_p->Start(); // start filling buffer

    try {
        fscRecoverer.Unpack(); // start reading buffer and filling FSC
        ostringstream sstr;
        sstr << "Finished FSC recover for volume: " << a_medVolIDstr << 
                "(splits: " << fscRecoverer.GetSplitCount() << ").";
        log_WriteEvent(sstr.str(), "RECOVERY");
    }
    catch (...) {
        ostringstream sstr;
        sstr << "ABORT! FSC recover for volume: " << a_medVolIDstr << 
                "(at split: " << fscRecoverer.GetSplitCount() << ").";
        log_WriteEvent(sstr.str(), "RECOVERY");
//        m_dataLMgr.AbortTransaction();
        throw;
    }

    m_dataLMgr.FlushChangesAndCleanCache();

//    m_dataLMgr.EndTransaction();
}

Here is the call graph for this function:

Here is the caller 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 350 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(), 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.

                                                                {
    log_FUNC_m(GetCopiesPos);
    
    try {
        log_DBG_m(dbg_NORM, "GetCopiesPos( FileID = " << a_fileID 
                         << ", MigID = " << a_migID 
                         << ", fileSize = " << a_fileSize << ")");
        ivd_CopiesPos_v_t copiesPos_v;
        
        m_dataLMgr.GetCopiesPos(
            copiesPos_v,
            a_fileID,
            static_cast<ivd_MigrationID_t&>(a_migID),
            a_fileSize);

        int copyNo = copiesPos_v.size();

        if (copyNo == 0) {
            string s("Wrong argument or Error. fileID=" 
                + cmn_Num2Str((Int32_t)a_fileID) 
                + " MigID=" + cmn_Num2Str(a_migID));
            log_WRN_m(s);
        }        

        i_CopiesPos_v_t *copies_v = new i_CopiesPos_v_t(copyNo);  // max space

        copies_v->length(copyNo);  // used space

        for (int c = 0; c < copyNo; c++) {
            ivd_MediaPos_v_t &medPos_v = copiesPos_v[c];
        
            int splitNo = medPos_v.size();
    //        i_MediumPos_v_t *medium_v = new i_MediumPos_v_t(splitNo);  // max space
            i_MediumPos_v_t &medium_v = (*copies_v)[c];
            medium_v.length(splitNo);
        
            for (int s = 0; s < splitNo; s++) {
                ivd_MediaPos_t &medPos = medPos_v[s];
                i_MediumPos_t   &medium  = medium_v[s];
                medium.dataType    = medPos.dataType;
                medium.mediumKey   = medPos.mediaKey;
                medium.medVolNum   = medPos.medVolNum;

                medium.blockOffset = medPos.blockOffset;
                medium.splitSize   = medPos.splitSize;
                medium.splitOffset = medPos.splitOffset;

            }
        }
//        try {
            log_DBG_m(dbg_LOW,ipc_Log::LogCopiesPosition(*copies_v));
//        } CATCH_CORBA_DETAIL_EXCEPTION
        
        return copies_v;
    }
    ipc_CATCH_IVD_THROW_CORBA_m;
}

Here is the call graph for this function:

i_FileHistoryList_t * i_FSC_i::GetFileHistory ( i_FileID_t  a_fileID  ) 

Definition at line 705 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.

                                                               {
    log_FUNC_m(GetFileHistory);

    try {
    
        fsc_GenIDsize_v generations;
        // the generations vector will be fill up with generations
        ivd_MigrationID_t nscMigID(0);
        string filePath("n/a");
        
        m_dataLMgr.GetHistory(a_fileID, generations, nscMigID, filePath);

        i_FileHistoryList_t_var fhl = new i_FileHistoryList_t;
        fhl->length(generations.size());
        for (UInt32_t i(0); i < fhl->length(); i++) {
            i_FileHistory_t & hist = fhl[i];
            hist.migrationID = generations[i].migID;
            hist.fileSize    = generations[i].fileSize;
            hist.dataType    = generations[i].dataType;
            if (nscMigID == hist.migrationID) {
                hist.fileName = CORBA::string_dup(filePath.c_str());
            }
            else {
                hist.fileName = CORBA::string_dup("n/a");
            }
        }
        return fhl._retn();
    } ipc_CATCH_IVD_THROW_CORBA_m  
}

Here is the call graph for this function:

i_FileIDs_t * i_FSC_i::GetFileIDs ( i_Count_t  a_count  ) 

Definition at line 322 of file i_FSC_impl.cpp.

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

                                                 {
    log_FUNC_m(GetFileIDs);

    log_DBG_m(dbg_NORM, "GetFileIDs(" << a_count << ")");

    try {
        fsc_FileID_v_t fileIDvec;

        fio_Transaction *trans_p = m_fscDB.GetTransObj();
        m_dataLMgr.GetBunchOfFileIDs(fileIDvec, a_count, *trans_p);
        m_fscDB.ReleaseTransObj(&trans_p);

        int size = fileIDvec.size();
        i_FileIDs_t *fileIDs = new i_FileIDs_t(a_count);  // max space
        fileIDs->length(size);  // used space
        if ( size > 0 ) { 
            fsc_FileID_v_i iter = fileIDvec.begin();
            for (int i = 0; i < size; i++, iter++ ) {
                 (*fileIDs)[i] = *iter;
            }
        } 
        return fileIDs;
    }
    ipc_CATCH_IVD_THROW_CORBA_m;
}

Here is the call graph for this function:

cmn_Path i_FSC_i::GetFscPath (  )  [inline]

Definition at line 187 of file i_FSC_impl.h.

{ return m_fscPath;};

UInt32_t i_FSC_i::GetNumOfUsedFileID (  )  [inline]

Definition at line 178 of file i_FSC_impl.h.

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

Definition at line 189 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(), 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().

                                     {

    log_FUNC_m(InsertSplitFromFRIBlock);

    cmn_MutexLock l(g_fscUpdate_x);

    try {
        i_CollocationIDs_t_var collocationIds(new i_CollocationIDs_t);
        log_DBG_m(dbg_DETAIL, "InsertSplitFromFRIBlock() mediumKey " << a_friInfo.mediaKey
            << ", medVolNum " << a_friInfo.medVolNum
            << ", migID " << a_friInfo.migID
            << ", copyID " << a_friInfo.copyID
            << endl);

        stx_CacheKey_t key = fsc_FRIblockUnpacker::KeyGen(a_friInfo.migID,
                                                          a_friInfo.copyID);
        { cmn_MutexLock l(m_friBlockUnpackerCache_x);
        
            fsc_FRIblockUnpacker* friUnpacker_p 
                = static_cast<fsc_FRIblockUnpacker*>(m_friBlockUnpackerCache.Get(key));
            UInt32_t blockSize = a_friBlock.length();
            if (friUnpacker_p == NULL) {
                friUnpacker_p = new fsc_FRIblockUnpacker(key, 
                                                        m_dataLMgr, 
                                                        // dataL cache size
                                                        // average size of FRI file size is 512 bytes
                                                        blockSize >> 9,
                                                        a_friInfo.medVolNum,
                                                        a_friInfo.mediaKey,
                                                        blockSize);
                m_friBlockUnpackerCache.Insert(friUnpacker_p);
            }
            else {
                log_DBG_m(dbg_DETAIL, "Found fsc_FRIblockUnpacker, Key = "
                    << " migID " << (friUnpacker_p->GetCacheKey() >> 4)
                    << ", copyID " <<  (friUnpacker_p->GetCacheKey() & 15)
                    << endl);        
                    
                if (   a_friInfo.medVolNum != (Int32_t)friUnpacker_p->GetMedVolNum()
                    || a_friInfo.mediaKey  != friUnpacker_p->GetMediumKey() ) {
                    log_ERR_m("Same FRI-block object but different medium." << endl
                            << "Probably missing FRIEnd by previous split." << endl
                            << "FRI unpacker will be removed and new is created." << endl
                            << a_friInfo
                            << (*friUnpacker_p)
                            << "a_friBlock : " << cmn_HexDump(a_friBlock.get_buffer(), 
                                                              blockSize > 1024 ? 1024 : blockSize, 
                                                              16, 
                                                              true));
                            
                    m_friBlockUnpackerCache.RemoveEl(friUnpacker_p);
                    friUnpacker_p = new fsc_FRIblockUnpacker(key, 
                                                            m_dataLMgr, 
                                                            // dataL cache size
                                                            // average size of FRI file size is 512 bytes
                                                            blockSize >> 9,
                                                            a_friInfo.medVolNum,
                                                            a_friInfo.mediaKey,
                                                            blockSize);
                    m_friBlockUnpackerCache.Insert(friUnpacker_p);                            
                }
            }

            g_DataLcache.Resize(blockSize >> 9); // 512 is average size of split in FRI
//            friUnpacker_p->SetNewDataBlock();
            try {
                const UInt8_t* block_p = reinterpret_cast<const UInt8_t*>(a_friBlock.get_buffer());
                if (friUnpacker_p->Unpack(block_p, 0) == rec_FRIEnd_c) {
                    // @todo lock each fileID in block!
                    log_DBG_m(dbg_DETAIL, "Remove fsc_FRIblockUnpacker, Key = "
                        << " migID " << (friUnpacker_p->GetCacheKey() >> 4)
                        << ", copyID " <<  (friUnpacker_p->GetCacheKey() & 15)
                        << endl);
                    m_friBlockUnpackerCache.RemoveEl(friUnpacker_p);
                }
            }
            catch (ivd_DFError e) {
                if (  e.GetError() == ie_DF_INVSEQ
                   && friUnpacker_p->GetPrevRecType() == rec_ExpectFRIStart_c) {
                    log_ERR_m("New FRI unpacker, but it does not start with FRI-start record." << endl
                            << "No FSC update. Migration is probably aborted." << endl
                            << a_friInfo
                            << (*friUnpacker_p)
                            << "a_friBlock : " << cmn_HexDump(a_friBlock.get_buffer(), 
                                                              blockSize > 1024 ? 1024 : blockSize, 
                                                              16, 
                                                              true));
                    m_friBlockUnpackerCache.RemoveEl(friUnpacker_p);
                }
                throw;
            }

            vector<UInt64_t> minorColIds = friUnpacker_p->GetMinorCollocationIds();
            UInt32_t numColIds(minorColIds.size());
            collocationIds->length(numColIds);
            for (UInt32_t i(0); i < numColIds; i++) {
                collocationIds[i] = minorColIds[i];
            }
        } // block where m_friBlockUnpackerCache_x is locked
        
        // @todo unlock each fileID at end of block handling!
        m_dataLMgr.FlushChangesAndCleanCache();

        return collocationIds._retn();
    }
    ipc_CATCH_IVD_THROW_CORBA_m;

}

Here is the call graph for this function:

bool i_FSC_i::IsIVDFSRecoveryRun (  )  [inline]

Definition at line 186 of file i_FSC_impl.h.

{ return m_IVDFSRecoveryRun; };

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

Definition at line 772 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().

                                                          {
    log_FUNC_m(IVDFSRecovery);
    /*ui_MsgWriter msgWriter(g_cmn.dirs.log + 
                          ( string("hsmfs_recovery_") + a_partitionName + string(".log")),
                          a_uims, false);
*/
    log_DBG_m(dbg_DETAIL, "m_IVDFSRecoveryRun = " << m_IVDFSRecoveryRun);
    log_DBG_m(dbg_DETAIL, "m_IVDFSRecoveryAbort = " << m_IVDFSRecoveryAbort);
    m_recoveryInProgress_x.Lock();
    if (m_IVDFSRecoveryRun) { 
        a_uims.DisplayMessage("HSMFS recovery already run.");
        return;
    }
    m_IVDFSRecoveryRun   = true;
    m_IVDFSRecoveryAbort = false;
    m_recoveryInProgress_x.Unlock();

    try {
        nsc_ScanForIVDFSRecovery(a_partitionName, a_ihsm, a_uims, m_IVDFSRecoveryAbort);
    }
    catch (ivd_Exception ) {
        cmn_MutexLock l(m_recoveryInProgress_x);
        m_IVDFSRecoveryRun   = false;
        m_IVDFSRecoveryAbort = false;
        throw;
    }

    cmn_MutexLock l(m_recoveryInProgress_x);
    m_IVDFSRecoveryRun   = false;
    m_IVDFSRecoveryAbort = false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void i_FSC_i::IVDFSRecoveryAbort (  ) 

Definition at line 807 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().

                                 {
    log_FUNC_m(IVDFSRecoveryAbort);
    cmn_MutexLock l(m_recoveryInProgress_x);
    ostringstream sstr;
    if (!m_IVDFSRecoveryRun) {
        sstr << "Can't Abort. HSMFS recovery not running."; // << 
        log_WriteEvent(sstr.str(), "RECOVERY");
        return;
    }
    sstr << "Ask for abort."; // << 
    log_WriteEvent(sstr.str(), "RECOVERY");
    m_IVDFSRecoveryAbort = true;    
}

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 588 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().

                                                                  {
    log_FUNC_m(RedundantCopy);

    { // NOTE! must be in block, because of collection gresult in destructos
        log_DBG_m(dbg_DETAIL, "Before fsc_CollectorRedunCopy CTOR " << a_origMedVol.size() );
        fsc_CollectorRedunCopy redCopy( a_results,
                                        a_unavailFilesPerVol, 
                                        a_medStat, 
                                        a_origMedKey,
                                        a_origMedVol,
                                        a_best_effort);
        
        fsc_RawScan fscScan(false, redCopy);
        fscScan.ScanAllFileID();
    }
    sort(a_results.begin(), a_results.end());
    
    ostringstream sstr;
    sstr << " Used media for redundant copy of media " << a_origMedKey << endl
         << " MediumKey VolNum      DataSize" << endl
         << "===============================";
    fsc_RedunCopyResult_v_i iter = a_results.begin();
    for (; iter != a_results.end(); ++iter) {
        iter->buffSize = iter->buffSize/cfg_MEGABYTE + 1;
        sstr << endl
             << setw(10) << iter->mediumKey 
             << setw( 7) << iter->medVolNum
             << setw(14) << iter->buffSize;
    }
    log_DBG_m(dbg_DETAIL, sstr.str());

}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 759 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().

                                                       {
    log_FUNC_m(ReleaseVolEntries);
    cmn_MutexLock l(m_reorgScanRelease_x);
    ostringstream sstr;
    sstr << " Start releasing entries from medium " << a_mediumKey 
         << ", volume " << a_medVolNum
         << " on partition " << m_partitionName;
    log_WriteEvent(sstr.str(), "Reorg");
    m_dataLMgr.Remove(m_partitionName, a_mediumKey, a_medVolNum);
}

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 563 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().

                                                               {
    log_FUNC_m(ReorgScan);

    cmn_MutexLock l(m_reorgScanRelease_x);
    g_fscScanInfo.clear();
    fsc_RawReorgScanDataCollector collectForReorg(m_partitionName, a_expDate, a_numGener);
    fsc_RawScan fscScan(false, collectForReorg);
    fscScan.ScanAllFileID();
    return g_fscScanInfo;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 189 of file i_FSC_impl.h.

Referenced by i_PartitionManager_i::CheckFSCvsIVDFS().

{ m_ms = ms;};

Here is the caller graph for this function:

i_Status_t i_FSC_i::Suspend ( void   ) 

Definition at line 466 of file i_FSC_impl.cpp.

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

                            {
    log_FUNC_m(Suspend);
    try {
        m_fscDB.Suspend();
        log_WriteEvent("FSC suspend successful.", "FSC");
        return 0;
    }
    catch (...) {
        log_WriteEvent(evt_ERROR, "FSC suspend failed.", "FSC");        
        return 1;
    }
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from i_Component_i.

Definition at line 194 of file i_FSC_impl.h.

bool& i_FSC_i::m_down [private]

Definition at line 67 of file i_FSC_impl.h.

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

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 83 of file i_FSC_impl.h.

Referenced by CompleteMigration(), and InsertSplitFromFRIBlock().

Definition at line 84 of file i_FSC_impl.h.

Referenced by CompleteMigration(), and InsertSplitFromFRIBlock().

Definition at line 65 of file i_FSC_impl.h.

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

Definition at line 64 of file i_FSC_impl.h.

const cmn_Path i_FSC_i::m_fscPath [private]

Definition at line 62 of file i_FSC_impl.h.

Referenced by CheckWithMedVolume(), and CollectByVolume().

Definition at line 71 of file i_FSC_impl.h.

Referenced by IVDFSRecovery(), and IVDFSRecoveryAbort().

Definition at line 70 of file i_FSC_impl.h.

Referenced by IVDFSRecovery(), and IVDFSRecoveryAbort().

bool i_FSC_i::m_mediaCheckRun [private]

Definition at line 74 of file i_FSC_impl.h.

Definition at line 73 of file i_FSC_impl.h.

Referenced by CheckWithMedVolume().

Definition at line 90 of file i_FSC_impl.h.

Referenced by CheckWithIVDFS().

Definition at line 86 of file i_FSC_impl.h.

Referenced by CheckWithIVDFS().

const string i_FSC_i::m_partitionName [private]

Definition at line 60 of file i_FSC_impl.h.

Referenced by ReleaseVolEntries(), and ReorgScan().

Definition at line 69 of file i_FSC_impl.h.

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

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

Definition at line 77 of file i_FSC_impl.h.

Referenced by ReleaseVolEntries(), and ReorgScan().


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