All temp objects are added *only* to PGBackend::temp_content.
cleaning RecoveryBackend::temp_contents (which is always empty) instead
of PGBackend::temp_contents is wrong.
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
(cherry picked from commit
71ba42693e7334f3905fb7a45a29caa16e5e8a58)
friend class ::crimson::osd::PG;
protected:
- boost::container::flat_set<hobject_t> temp_contents;
-
template <class... Args>
void add_temp_obj(Args&&... args) {
temp_contents.insert(std::forward<Args>(args)...);
clear_temp_obj(oid);
}
}
+ template <typename Func>
+ void for_each_temp_obj(Func &&f) {
+ std::for_each(temp_contents.begin(), temp_contents.end(), f);
+ }
+ void clear_temp_objs() {
+ temp_contents.clear();
+ }
+private:
+ boost::container::flat_set<hobject_t> temp_contents;
+
friend class RecoveryBackend;
};
void RecoveryBackend::clean_up(ceph::os::Transaction& t,
std::string_view why)
{
- for (auto& soid : temp_contents) {
+ for_each_temp_obj([&](auto &soid) {
t.remove(pg.get_collection_ref()->get_cid(),
ghobject_t(soid, ghobject_t::NO_GEN, pg.get_pg_whoami().shard));
- }
- temp_contents.clear();
+ });
+ clear_temp_objs();
for (auto& [soid, recovery_waiter] : recovering) {
if ((recovery_waiter->pull_info
#include "crimson/os/futurized_collection.h"
#include "crimson/osd/pg_interval_interrupt_condition.h"
#include "crimson/osd/object_context.h"
+#include "crimson/osd/pg_backend.h"
#include "crimson/osd/shard_services.h"
#include "messages/MOSDPGBackfill.h"
class PG;
}
-class PGBackend;
-
class RecoveryBackend {
public:
class WaitForObjectRecovery;
const hobject_t& target,
eversion_t version) const;
- boost::container::flat_set<hobject_t> temp_contents;
-
void add_temp_obj(const hobject_t &oid);
void clear_temp_obj(const hobject_t &oid);
+ template <typename Func>
+ void for_each_temp_obj(Func &&f) {
+ backend->for_each_temp_obj(std::forward<Func>(f));
+ }
+ void clear_temp_objs() {
+ backend->clear_temp_objs();
+ }
void clean_up(ceph::os::Transaction& t, std::string_view why);
virtual seastar::future<> on_stop() = 0;