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>
ShardServices &shard_services,
epoch_t epoch);
+
Ref<PG> get_pg(spg_t pgid);
template <typename F>
void for_each_pg(F &&f) const {
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);