]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/shard_services: Add function create_split_pg_mapping for PG splitting
authorAishwarya Mathuria <amathuri@redhat.com>
Wed, 19 Mar 2025 10:25:47 +0000 (10:25 +0000)
committerAishwarya Mathuria <amathuri@redhat.com>
Thu, 22 May 2025 06:20:38 +0000 (06:20 +0000)
Previously, get_or_create_pg_mapping was used to assign a new child PG to a specific core. When a peering operation occurred, it determined the core responsible for the PG and forwarded the operation there using get_or_create_pg_mapping.

However, earlier changes did not ensure that the split child PG creation logic ran on the same core to which it was mapped. This led to an issue where PGMap::pg_created could be updated on shard 0, while the child PG was actually mapped to shard 1. When a peering operation for the new PG arrived, it was forwarded to shard 1. Since the PG had been created on shard 0, shard 1 had no record of it and attempted to create it again. This resulted in an assertion failure in BlueStore due to an attempt to create a collection for an already existing PG.

This commit adds a function create_split_pg_mapping that will resolve the issue by ensuring that child PG creation always occurs on the core to which the PG is mapped.

Signed-off-by: Aishwarya Mathuria <amathuri@redhat.com>
src/crimson/osd/shard_services.h

index 61880909bcddd69b7cef9aad8925e55d3da69aff..4c7f2dbf578163e30ffa8476fe27a862fe9aa0ef 100644 (file)
@@ -127,6 +127,7 @@ class PerShardState {
     ShardServices &shard_services,
     epoch_t epoch);
 
+
   Ref<PG> get_pg(spg_t pgid);
   template <typename F>
   void for_each_pg(F &&f) const {
@@ -481,6 +482,10 @@ public:
     return {get_reactor_utilization()};
   }
 
+  auto create_split_pg_mapping(spg_t pgid, core_id_t core) {
+    return pg_to_shard_mapping.get_or_create_pg_mapping(pgid, core);
+  }
+
   auto remove_pg(spg_t pgid) {
     local_state.pg_map.remove_pg(pgid);
     return pg_to_shard_mapping.remove_pg_mapping(pgid);