Exemple #1
0
void
Restore::collect_garbage_(be::BackendInterfacePtr bi,
                          const vd::OrderedTLogIds& doomed_tlogs) const
{
    LOG_INFO(bi->getNS() << ": collecting garbage");

    for (const auto& tlog_id : doomed_tlogs)
    {
        const auto tlog_name(boost::lexical_cast<std::string>(tlog_id));

        try
        {
            std::unique_ptr<vd::TLogReaderInterface>
                r(new vd::TLogReader(scratch_dir_,
                                     tlog_name,
                                     bi->clone()));

            std::vector<vd::SCO> doomed_scos;
            r->SCONames(doomed_scos);

            LOG_INFO(bi->getNS() << ": removing surplus tlog " << tlog_name);
            try
            {
                bi->remove(tlog_name,
                           ObjectMayNotExist::T);
            }
            CATCH_STD_ALL_LOGLEVEL_IGNORE(bi->getNS() << ": failed to remove " << tlog_name,
                                          WARN);


            for (const auto& sco : doomed_scos)
            {
                LOG_INFO(bi->getNS() << ": removing surplus sco " << sco);
                try
                {
                    bi->remove(sco.str(), ObjectMayNotExist::T);
                }
                CATCH_STD_ALL_LOGLEVEL_IGNORE(bi->getNS() << ": failed to remove " <<
                                              sco,
                                              WARN);
            }
        }
        CATCH_STD_ALL_LOGLEVEL_IGNORE(bi->getNS() <<
                                      ": failed to process tlog " << tlog_name <<
                                      " - it probably didn't make it to the backend?",
                                      WARN);
    }
}
void
FileSystemTestSetup::TearDown()
{
    bpt::ptree pt;

    // Fill the ptree first as it requires e.g. the mdstore_test_setup_ to be
    // still around.
    make_config_(pt,
                 topdir_,
                 local_config().vrouter_id);

    stop_failovercache_for_local_node();

    mdstore_test_setup_.reset();
    mds_server_config_.reset();
    mds_manager_.reset();
    mds_test_setup_ = nullptr;

    try
    {
        vfs::FileSystem::destroy(pt);
    }
    CATCH_STD_ALL_LOGLEVEL_IGNORE("Failed to clean up filesystem - resources might be leaked; manual intervention required",
                                  FATAL);

    arakoon_test_setup_->tearDownArakoon();

    uninitialize_connection_manager();

    fs::remove_all(topdir_);

    Py_Finalize();
}
uint64_t
RocksDBMetaDataBackend::locally_used_bytes(const VolumeConfig& cfg)
{
    const fs::path p(VolManager::get()->getMetaDataPath(cfg));
    try
    {
        return fs::file_size(p / db_name);
    }
    CATCH_STD_ALL_LOGLEVEL_IGNORE("failed to determine size of " << p, WARN);

    return 0;
}