File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed
Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -513,6 +513,35 @@ Context *PG::on_clean()
513513 return nullptr ;
514514}
515515
516+ seastar::future<> PG::clear_temp_objects ()
517+ {
518+ logger ().info (" {} {}" , __func__, pgid);
519+ ghobject_t _next;
520+ ceph::os::Transaction t;
521+ auto max_size = local_conf ()->osd_target_transaction_size ;
522+ while (true ) {
523+ auto [objs, next] = co_await shard_services.get_store ().list_objects (
524+ coll_ref, _next, ghobject_t::get_max (), max_size);
525+ if (objs.empty ()) {
526+ if (!t.empty ()) {
527+ co_await shard_services.get_store ().do_transaction (
528+ coll_ref, std::move (t));
529+ }
530+ break ;
531+ }
532+ for (auto &obj : objs) {
533+ if (obj.hobj .is_temp ()) {
534+ t.remove (coll_ref->get_cid (), obj);
535+ }
536+ }
537+ _next = next;
538+ if (t.get_num_ops () >= max_size) {
539+ co_await shard_services.get_store ().do_transaction (
540+ coll_ref, t.claim_and_reset ());
541+ }
542+ }
543+ }
544+
516545PG::interruptible_future<seastar::stop_iteration> PG::trim_snap (
517546 snapid_t to_trim,
518547 bool needs_pause)
Original file line number Diff line number Diff line change @@ -604,6 +604,7 @@ class PG : public boost::intrusive_ref_counter<
604604 ObjectContextRef obc,
605605 const std::error_code e,
606606 ceph_tid_t rep_tid);
607+ seastar::future<> clear_temp_objects ();
607608
608609private:
609610
Original file line number Diff line number Diff line change @@ -35,8 +35,10 @@ seastar::future<> PGShardManager::load_pgs(crimson::os::FuturizedStore& store)
3535 pgid
3636 ).then ([pgid, &per_shard_state](auto &&pg) {
3737 logger ().info (" load_pgs: loaded {}" , pgid);
38- per_shard_state.pg_map .pg_loaded (pgid, std::move (pg));
39- return seastar::now ();
38+ return pg->clear_temp_objects (
39+ ).then ([&per_shard_state, pg, pgid] {
40+ per_shard_state.pg_map .pg_loaded (pgid, std::move (pg));
41+ });
4042 });
4143 });
4244 });
You can’t perform that action at this time.
0 commit comments