]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/tools/objectstore: add GC operation to crimson-objectstore-tool
authorRonen Friedman <rfriedma@redhat.com>
Thu, 16 Apr 2026 17:58:09 +0000 (17:58 +0000)
committerRonen Friedman <rfriedma@redhat.com>
Tue, 28 Apr 2026 05:11:04 +0000 (05:11 +0000)
This adds a GC operation to the crimson-objectstore-tool, allowing
us to trigger GC cycles on demand during testing. This will
help reduce segment pressure and avoid 'no-segments' conditions.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/crimson/os/seastore/extent_placement_manager.h
src/crimson/tools/objectstore/crimson_objectstore_tool.cc
src/crimson/tools/objectstore/objectstore_tool.cc
src/crimson/tools/objectstore/objectstore_tool.h

index af823f8c209102dbfc3ffd77c5d740ec9c2f7330..123826f16be77d5f7f28200e5b64259934b28c2e 100644 (file)
@@ -882,6 +882,7 @@ private:
     }
 
     seastar::future<> run_until_halt();
+
     seastar::future<> run_cleaner_until_done();
 
     bool is_no_background() const {
index 4c37abc3000b22ca37f230409c4338e0402ab8f7..f3c39e35e4528e2e5ab5251613fff06fd8400ed8 100644 (file)
@@ -92,6 +92,9 @@ enum class operation_type_t {
 
   // Device-inspection operations (--op)
   DUMP_SUPERBLOCK,
+
+  // Maintenance operations (--op)
+  GC,
 };
 
 std::string to_string(operation_type_t op) {
@@ -115,6 +118,7 @@ std::string to_string(operation_type_t op) {
     case operation_type_t::SET_SIZE: return "set-size";
     case operation_type_t::CLEAR_DATA_DIGEST: return "clear-data-digest";
     case operation_type_t::DUMP_SUPERBLOCK: return "dump-superblock";
+    case operation_type_t::GC: return "gc";
     default: return "unknown";
   }
 }
@@ -124,6 +128,7 @@ tl::expected<operation_type_t, std::string> parse_pg_operation(const std::string
   if (op_str == "list") return operation_type_t::LIST_OBJECTS;
   if (op_str == "info") return operation_type_t::INFO;
   if (op_str == "dump-superblock") return operation_type_t::DUMP_SUPERBLOCK;
+  if (op_str == "gc") return operation_type_t::GC;
   return tl::unexpected("Unsupported PG operation: " + op_str);
 }
 
@@ -723,7 +728,8 @@ seastar::future<int> run_tool(StoreTool& st, objectstore_config_t& config) {
 
   // Resolve object and pgid before executing operations
   if (config.operation->op != operation_type_t::LIST_PGS &&
-      config.operation->op != operation_type_t::DUMP_SUPERBLOCK) {
+      config.operation->op != operation_type_t::DUMP_SUPERBLOCK &&
+      config.operation->op != operation_type_t::GC) {
     bool resolved = co_await resolve_operation_parameters(st, config);
     if (!resolved) {
       co_return EXIT_FAILURE;
@@ -996,6 +1002,11 @@ seastar::future<int> run_tool(StoreTool& st, objectstore_config_t& config) {
       break;
     }
 
+    case operation_type_t::GC: {
+      co_await st.do_gc();
+      break;
+    }
+
     default:
       fmt::println(std::cerr, "Operation {} not implemented yet", to_string(op.op));
       co_return EXIT_FAILURE;
index 6fd8d6027482b238f7522529e0d8df15bc9ebc16..c861dd20822bc8dc12aa576305f1303bebe6d2dd 100644 (file)
@@ -26,6 +26,11 @@ seastar::future<> StoreTool::stop()
   co_return;
 }
 
+seastar::future<> StoreTool::do_gc()
+{
+  co_await store->do_gc();
+}
+
 seastar::future<std::vector<crimson::os::coll_core_t>> StoreTool::list_pgs()
 {
   co_return co_await store->list_collections();
index f8000d5092a973ca7be16fc5b05b6e80771b135e..ce5470c982085aee211100ad4ac17203804b2f81 100644 (file)
@@ -25,6 +25,7 @@ public:
   StoreTool(std::unique_ptr<crimson::os::FuturizedStore> store): store(std::move(store)) {}
 
   seastar::future<> stop();
+  seastar::future<> do_gc();
   void set_shard_id(seastar::shard_id shard_id) { this->shard_id = shard_id; }
   
   // PG operations