Commit d9e8b88e authored by Michael Davis's avatar Michael Davis
Browse files

[migration] Implements eos-import-files --list-failures and --list-failure-modes

parent ff27302b
......@@ -82,15 +82,14 @@ EosImportFiles::EosImportFiles(const std::string &configfile, bool retry) :
void EosImportFiles::listFailureModes()
{
#if 0
const std::string sql = "SELECT "
"RETC, "
"REGEXP_REPLACE(REPLACE(MESSAGE, PATH, '<path>'), 'id=[0-9]*', 'id=<id>') AS MSG, "
"COUNT(*) AS CNT "
"FROM CTADIRSFAILED "
"GROUP BY RETC, "
"REGEXP_REPLACE(REPLACE(MESSAGE, PATH, '<path>'), 'id=[0-9]*', 'id=<id>') "
"ORDER BY RETC, MSG";
const std::string sql = "SELECT"
" RETC,"
" REGEXP_REPLACE(MESSAGE, 'id=[0-9]*', 'id=<id>') AS MSG,"
" COUNT(*) AS CNT"
" FROM CTAFILESFAILED"
" GROUP BY RETC,"
" REGEXP_REPLACE(MESSAGE, 'id=[0-9]*', 'id=<id>')"
" ORDER BY RETC, MSG";
auto stmt = m_dbConn.createStmt(sql);
auto rset = stmt.executeQuery();
......@@ -98,34 +97,34 @@ void EosImportFiles::listFailureModes()
std::cout << rset.columnString("MSG") << " (retc=" << rset.columnUint64("RETC")
<< ", count=" << rset.columnUint64("CNT") << ")" << std::endl;
}
#endif
}
void EosImportFiles::listFailures()
{
#if 0
const std::string sql = "SELECT FILEID, PATH, RETC, MESSAGE FROM CTADIRSFAILED";
const std::string sql = "SELECT"
" A.FILEID, B.PATH, A.FILENAME, A.RETC, A.MESSAGE"
" FROM CTAFILESFAILED A, CTADIRSHELPER B"
" WHERE A.PARENT_FILEID = B.FILEID";
m_selectFilesDbStmt = m_dbConn.createStmt(sql);
auto stmt = m_dbConn.createStmt(sql);
auto rset = stmt.executeQuery();
while(rset.next()) {
std::cout << rset.columnString("FILEID") << " " << rset.columnString("PATH") << " "
std::cout << rset.columnString("FILEID") << " "
<< rset.columnString("PATH") << "/" << rset.columnString("FILENAME") << " "
<< rset.columnString("MESSAGE") << " (retc=" << rset.columnUint64("RETC") << ")" << std::endl;
}
#endif
}
void EosImportFiles::forgetFailures()
{
#if 0
const std::string sql = "DELETE FROM CTADIRSFAILED WHERE PATH LIKE '" + m_topLevelPath + "%'";
const std::string sql = "DELETE FROM CTAFILESFAILED";
auto stmt = m_dbConn.createStmt(sql);
std::cerr << "Deleting from CTADIRSFAILED...";
std::cerr << "Deleting from CTAFILESFAILED...";
stmt.executeNonQuery();
std::cerr << "done." << std::endl;
#endif
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment