From 6a130a70077dced7104678c8f8933e2d56f64492 Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Tue, 23 Jan 2024 12:18:05 +0000 Subject: [PATCH] crimson/os/cyanstore: support OP_RMCOLL Signed-off-by: Matan Breizman --- src/crimson/os/cyanstore/cyan_store.cc | 17 +++++++++++++++++ src/crimson/os/cyanstore/cyan_store.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/crimson/os/cyanstore/cyan_store.cc b/src/crimson/os/cyanstore/cyan_store.cc index f2a6018e36a..36230893d36 100644 --- a/src/crimson/os/cyanstore/cyan_store.cc +++ b/src/crimson/os/cyanstore/cyan_store.cc @@ -494,6 +494,12 @@ seastar::future<> CyanStore::Shard::do_transaction_no_callbacks( r = _create_collection(cid, op->split_bits); } break; + case Transaction::OP_RMCOLL: + { + coll_t cid = i.get_cid(op->cid); + r = _remove_collection(cid); + } + break; case Transaction::OP_SETALLOCHINT: { r = 0; @@ -863,6 +869,17 @@ int CyanStore::Shard::_create_collection(const coll_t& cid, int bits) return 0; } +int CyanStore::Shard::_remove_collection(const coll_t& cid) +{ + logger().debug("{} cid={}", __func__, cid); + auto c = _get_collection(cid); + if (!c) { + return -ENOENT; + } + coll_map.erase(cid); + return 0; +} + boost::intrusive_ptr CyanStore::Shard::_get_collection(const coll_t& cid) { diff --git a/src/crimson/os/cyanstore/cyan_store.h b/src/crimson/os/cyanstore/cyan_store.h index 307f9ec32ed..518222d82f6 100644 --- a/src/crimson/os/cyanstore/cyan_store.h +++ b/src/crimson/os/cyanstore/cyan_store.h @@ -148,6 +148,7 @@ class CyanStore final : public FuturizedStore { std::string_view name); int _rm_attrs(const coll_t& cid, const ghobject_t& oid); int _create_collection(const coll_t& cid, int bits); + int _remove_collection(const coll_t& cid); boost::intrusive_ptr _get_collection(const coll_t& cid); private: