From: Aishwarya Mathuria Date: Thu, 29 Jan 2026 11:53:54 +0000 (+0000) Subject: mon/OSDMonitor: allow PG splitting for crimson pools by default X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a236e9ec298929a742b480c96236769107b1b00c;p=ceph.git mon/OSDMonitor: allow PG splitting for crimson pools by default Previously, crimson pools were created with FLAG_NOPGCHANGE hardcoded, preventing any adjustment to pg_num since splitting and merging were not yet supported. This patch: - Removes the hardcoded FLAG_NOPGCHANGE during crimson pool creation, and instead honors the global 'osd_pool_default_flag_nopgchange'. - Introduces 'crimson_allow_pg_split' (default: true) to gate PG splitting. - Explicitly blocks PG merging (shrinking) for crimson pools, as shrinking remains unsupported. Signed-off-by: Aishwarya Mathuria --- diff --git a/src/common/options/crimson.yaml.in b/src/common/options/crimson.yaml.in index 031113ae7f55..ab4c5bcc33db 100644 --- a/src/common/options/crimson.yaml.in +++ b/src/common/options/crimson.yaml.in @@ -89,6 +89,17 @@ options: flags: - startup +- name: crimson_allow_pg_split + type: bool + level: advanced + default: true + desc: Allow Crimson pools to increase their PG count (split) + long_desc: When enabled, allows the monitor to increase pg_num for pools using + the crimson flag. + services: + - osd + - mon + # Bluestore options: - name: crimson_bluestore_num_threads diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index c71a66c853ab..1c746113ce9d 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -8270,7 +8270,6 @@ int OSDMonitor::prepare_new_pool(string& name, pi->use_gmt_hitset = false; if (crimson) { pi->set_flag(pg_pool_t::FLAG_CRIMSON); - pi->set_flag(pg_pool_t::FLAG_NOPGCHANGE); } pi->size = size; @@ -8626,6 +8625,18 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap, ss << "pool pg_num change is disabled; you must unset nopgchange flag for the pool first"; return -EPERM; } + // check for Crimson pools + // pg merging is not yet supported in Crimson + if (p.has_flag(pg_pool_t::FLAG_CRIMSON)) { + if (n < (int)p.get_pg_num()) { + ss << "crimson-osd does not support decreasing pg_num_actual (shrinking)"; + return -ENOTSUP; + } + if (n > (int)p.get_pg_num() && !g_conf().get_val("crimson_allow_pg_split")) { + ss << "crimson_allow_pg_split is false; pg_num_actual increase denied"; + return -EPERM; + } + } if (interr.length()) { ss << "error parsing integer value '" << val << "': " << interr; return -EINVAL; @@ -8677,6 +8688,18 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap, ss << "pool pg_num change is disabled; you must unset nopgchange flag for the pool first"; return -EPERM; } + // check for Crimson pools + // pg merging is not yet supported in Crimson + if (p.has_flag(pg_pool_t::FLAG_CRIMSON)) { + if (n < (int)p.get_pg_num_target()) { + ss << "crimson-osd does not support decreasing pg_num"; + return -ENOTSUP; + } + if (n > (int)p.get_pg_num_target() && !g_conf().get_val("crimson_allow_pg_split")) { + ss << "crimson_allow_pg_split is false; pg_num increase denied for crimson pool"; + return -EPERM; + } + } if (interr.length()) { ss << "error parsing integer value '" << val << "': " << interr; return -EINVAL; @@ -8746,6 +8769,18 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap, ss << "pool pgp_num change is disabled; you must unset nopgchange flag for the pool first"; return -EPERM; } + // check for Crimson pools + // pg merging is not yet supported in Crimson + if (p.has_flag(pg_pool_t::FLAG_CRIMSON)) { + if (n < (int)p.get_pgp_num()) { + ss << "crimson-osd does not support decreasing pgp_num_actual"; + return -ENOTSUP; + } + if (n > (int)p.get_pgp_num() && !g_conf().get_val("crimson_allow_pg_split")) { + ss << "crimson_allow_pg_split is false; pgp_num_actual increase denied"; + return -EPERM; + } + } if (interr.length()) { ss << "error parsing integer value '" << val << "': " << interr; return -EINVAL; @@ -8769,6 +8804,18 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap, ss << "pool pgp_num change is disabled; you must unset nopgchange flag for the pool first"; return -EPERM; } + // check for Crimson pools + // pg merging is not yet supported in Crimson + if (p.has_flag(pg_pool_t::FLAG_CRIMSON)) { + if (n < (int)p.get_pgp_num_target()) { + ss << "crimson-osd does not support decreasing pgp_num"; + return -ENOTSUP; + } + if (n > (int)p.get_pgp_num_target() && !g_conf().get_val("crimson_allow_pg_split")) { + ss << "crimson_allow_pg_split is false; pgp_num increase denied"; + return -EPERM; + } + } if (interr.length()) { ss << "error parsing integer value '" << val << "': " << interr; return -EINVAL;