Public Member Functions | Public Attributes | Private Attributes

FileInfoCache Class Reference
[Classes for managing events]

#include <treewalk.h>

Collaboration diagram for FileInfoCache:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FileInfoCache (ui_MsgWriter &a_msgWrite, int a_numFilesPerBatch, UInt32_t a_sysLoadPct, UInt64_t &a_missingCount, UInt64_t &a_missingCopyCount, UInt64_t &a_ownerMismatchCount)
bool AddFile (const FileInfo &a_fileInfoVecEl)
void CheckFiles ()

Public Attributes

 log_CLASSID_m

Private Attributes

vector< FileInfom_fileInfos
unsigned int m_numFilesPerBatch
ui_MsgWriterm_msgWrite
UInt64_tm_missingCount
 reference on TreeWalk member
UInt64_tm_missingCopyCount
UInt64_tm_ownerMismatchCount

Detailed Description

Definition at line 92 of file treewalk.h.


Constructor & Destructor Documentation

FileInfoCache::FileInfoCache ( ui_MsgWriter a_msgWrite,
int  a_numFilesPerBatch,
UInt32_t  a_sysLoadPct,
UInt64_t a_missingCount,
UInt64_t a_missingCopyCount,
UInt64_t a_ownerMismatchCount 
)

Definition at line 56 of file treewalk.cpp.

References log_FUNC_m, and m_fileInfos.

    :
    m_fileInfos(),
    m_numFilesPerBatch(a_numFilesPerBatch),
    m_msgWrite(a_msgWrite),
    m_missingCount(a_missingCount),
    m_missingCopyCount(a_missingCopyCount),
    m_ownerMismatchCount(a_ownerMismatchCount)
{
    log_FUNC_m(FileInfoCache);
    m_fileInfos.reserve(a_numFilesPerBatch);
}


Member Function Documentation

bool FileInfoCache::AddFile ( const FileInfo a_fileInfoVecEl  ) 

Definition at line 77 of file treewalk.cpp.

References CheckFiles(), dbg_DETAIL, log_DBG_m, log_FUNC_m, FileInfo::m_dirPath, FileInfo::m_fileID, m_fileInfos, FileInfo::m_name, m_numFilesPerBatch, and FileInfo::m_ownerID.

Referenced by TreeWalk::CheckDir().

                                                           {
    log_FUNC_m(AddFile);
    log_DBG_m(dbg_DETAIL,  "Add file " << a_fileInfoVecEl.m_dirPath + a_fileInfoVecEl.m_name
                            << ", inode: " << a_fileInfoVecEl.m_fileID 
                            << ", owner " << a_fileInfoVecEl.m_ownerID);

    m_fileInfos.push_back(a_fileInfoVecEl);
    if (m_fileInfos.size() >= m_numFilesPerBatch) {
        CheckFiles();
        return true;
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FileInfoCache::CheckFiles (  ) 

Definition at line 93 of file treewalk.cpp.

References i_FSCfileState_t::arrayIdx, i_FSCNumCopVsNumPoolsCheckStatus_t::changed, i_FSCNumCopVsNumPoolsCheckStatus_t::copiesExpected, i_FSCNumCopVsNumPoolsCheckStatus_t::copiesFound, dbg_DETAIL, ui_MsgWriter::DisplayMessage(), i_IvdfsFileInfo_t::fileID, i_IvdfsFileInfo_t::fileName, i_IvdfsFileInfo_t::fileSize, i_FSCfileState_t::fileState, i_FSCfileState_t::fscNumCopVsNumPoolsCheckStatus, g_iFSC, ipc_EXEC_m, log_DBG_m, log_FUNC_m, FileInfo::m_dirPath, FileInfo::m_fileID, m_fileInfos, m_missingCopyCount, m_missingCount, m_msgWrite, FileInfo::m_name, m_ownerMismatchCount, i_FSCfileState_t::migrationID, i_IvdfsFileInfo_t::ownerID, i_FSCfileState_t::ownerMismatch, i_FSCNumCopVsNumPoolsCheckStatus_t::splitInWrongPool, and i_FSCNumCopVsNumPoolsCheckStatus_t::tooMuchCopiesPerPool.

Referenced by AddFile(), TreeWalk::CheckDir(), and TreeWalk::~TreeWalk().

                               {
    log_FUNC_m(CheckFiles);

    if (m_fileInfos.size() == 0) {
        log_DBG_m(dbg_DETAIL,  " No files to check in FSC.");
        return;
    }

    log_DBG_m(dbg_DETAIL,  " Check files in FSC. batch size " << m_fileInfos.size());
    
    const UInt32_t maxOutputs = 100;
    unsigned int i = 0;

    i_IvdfsFileInfo_v_t seqTFileInfo(m_fileInfos.size());
    seqTFileInfo.length(m_fileInfos.size());
    for(vector<FileInfo>::const_iterator iter = m_fileInfos.begin();
        iter != m_fileInfos.end(); ++iter, ++i) {
        i_IvdfsFileInfo_t &iFileInfo = seqTFileInfo[i];
        iFileInfo.fileID   = iter->m_fileID;
        iFileInfo.fileSize = iter->m_size;
        iFileInfo.ownerID  = iter->m_ownerID;
        iFileInfo.fileName = CORBA::string_dup(iter->m_name.c_str());
    }
    i_FSCfileState_v_t_var fscFileState;
    ipc_EXEC_m (
        fscFileState = g_iFSC->CheckWithIVDFS(seqTFileInfo);
    )
    for (i = 0; i < fscFileState->length(); ++i) {
        i_FSCfileState_t &fscFI = fscFileState[i];
        FileInfo &fi = m_fileInfos[fscFI.arrayIdx];
        ostringstream sstrs;
        if (fscFI.fscNumCopVsNumPoolsCheckStatus.changed) {
            if (m_missingCopyCount < maxOutputs) {
                sstrs << fi.m_fileID << " "
                    << fscFI.migrationID << " "
                    << fi.m_dirPath + fi.m_name << endl;

                if (fscFI.fscNumCopVsNumPoolsCheckStatus.splitInWrongPool) {
                    sstrs << "File has splits in different pools!" << endl;
                }

                if (fscFI.fscNumCopVsNumPoolsCheckStatus.tooMuchCopiesPerPool) {
                    sstrs << "File has more than 2 copies per pool!" << endl;
                }

                if (fscFI.fscNumCopVsNumPoolsCheckStatus.copiesFound != fscFI.fscNumCopVsNumPoolsCheckStatus.copiesExpected) {
                    sstrs << "Copies found: " << fscFI.fscNumCopVsNumPoolsCheckStatus.copiesFound << ", ";
                    sstrs << "Copies expected: " << fscFI.fscNumCopVsNumPoolsCheckStatus.copiesExpected << "!" << endl;
                }

                m_msgWrite.DisplayMessage(sstrs.str().c_str());
            }
            ++m_missingCopyCount;
        }
        else if (fscFI.ownerMismatch){
            sstrs << fi.m_fileID << " "
                << fscFI.migrationID << " "
                << fi.m_dirPath + fi.m_name << endl << fscFI.fileState;

            m_msgWrite.DisplayMessage(sstrs.str().c_str());
            ++m_ownerMismatchCount;
        }
        else {
            sstrs << fi.m_fileID << " "
                << fscFI.migrationID << " "
                << fi.m_dirPath + fi.m_name << endl << fscFI.fileState;

            ++m_missingCount;
            m_msgWrite.DisplayMessage(sstrs.str().c_str());
        }
        
    }
    m_fileInfos.clear();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 107 of file treewalk.h.

Definition at line 111 of file treewalk.h.

Referenced by AddFile(), CheckFiles(), and FileInfoCache().

Definition at line 117 of file treewalk.h.

Referenced by CheckFiles().

reference on TreeWalk member

Definition at line 116 of file treewalk.h.

Referenced by CheckFiles().

Definition at line 113 of file treewalk.h.

Referenced by CheckFiles().

unsigned int FileInfoCache::m_numFilesPerBatch [private]

Definition at line 112 of file treewalk.h.

Referenced by AddFile().

Definition at line 118 of file treewalk.h.

Referenced by CheckFiles().


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