void
    test_after_tlog(bool failover)
    {
        const auto wrns(make_random_namespace());

        SharedVolumePtr v = make_volume(*wrns);

        const std::string pattern1("Hairdresser On Fire");

        {
            SCOPED_BLOCK_BACKEND(*v);

            writeToVolume(*v,
                          v->getClusterMultiplier() * CachePage::capacity(),
                          v->getClusterSize(),
                          pattern1);
        }

        v->scheduleBackendSync();
        waitForThisBackendWrite(*v);

        const std::string pattern2("Such A Little Thing Makes Such A Big Difference");

        writeToVolume(*v,
                      2 * v->getClusterMultiplier() * CachePage::capacity(),
                      v->getClusterSize(),
                      pattern2);

        const auto ncfgs(node_configs());

        if (failover)
        {
            mds_manager_->stop_one(ncfgs[0]);

            checkVolume(*v,
                        0,
                        v->getClusterSize(),
                        "");
        }
        else
        {
            const std::vector<MDSNodeConfig> ncfgs2{ ncfgs[1],
                                                     ncfgs[0] };

            v->updateMetaDataBackendConfig(MDSMetaDataBackendConfig(ncfgs2,
                                                                    ApplyRelocationsToSlaves::T));
        }

        check_config(*v,
                     ncfgs,
                     true);

        checkVolume(*v,
                    v->getClusterMultiplier() * CachePage::capacity(),
                    v->getClusterSize(),
                    pattern1);

        checkVolume(*v,
                    2 * v->getClusterMultiplier() * CachePage::capacity(),
                    v->getClusterSize(),
                    pattern2);

        destroyVolume(v,
                      DeleteLocalData::F,
                      RemoveVolumeCompletely::F);

        v = localRestart(wrns->ns());

        check_config(*v,
                     ncfgs,
                     true);

        checkVolume(*v,
                    v->getClusterMultiplier() * CachePage::capacity(),
                    v->getClusterSize(),
                    pattern1);

        checkVolume(*v,
                    2 * v->getClusterMultiplier() * CachePage::capacity(),
                    v->getClusterSize(),
                    pattern2);
    }
Exemple #2
0
vd::TLogId
api::scheduleBackendSync(const vd::VolumeId& volName)
{
    SharedVolumePtr v = VolManager::get()->findVolume_(volName);
    return v->scheduleBackendSync();
}