From 7124a44d84d6f92bf8ca8bac780c44cc09ad9fa7 Mon Sep 17 00:00:00 2001 From: Aishwarya Mathuria Date: Wed, 19 Mar 2025 10:25:47 +0000 Subject: [PATCH] crimson/osd/shard_services: Add function create_split_pg_mapping for PG splitting 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 --- src/crimson/osd/shard_services.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/crimson/osd/shard_services.h b/src/crimson/osd/shard_services.h index 61880909bcd..4c7f2dbf578 100644 --- a/src/crimson/osd/shard_services.h +++ b/src/crimson/osd/shard_services.h @@ -127,6 +127,7 @@ class PerShardState { ShardServices &shard_services, epoch_t epoch); + Ref get_pg(spg_t pgid); template 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); -- 2.39.5