]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: default chunk size change 64908/head
authorJake Squelch <Jake.Squelch@ibm.com>
Fri, 8 Aug 2025 10:10:34 +0000 (11:10 +0100)
committerJakesquelch <Jakewsquelchh@gmail.com>
Mon, 1 Sep 2025 08:52:45 +0000 (09:52 +0100)
      Changed chunk size value depending if EC optimisation was ON/OFF and if the plugin optimisations were supported.

Signed-off-by: Jake Squelch <Jake.Squelch@ibm.com>
qa/standalone/erasure-code/test-erasure-code.sh
src/common/options/mon.yaml.in
src/mon/OSDMonitor.cc
src/test/erasure-code/TestErasureCodeLrc.cc

index b9315123365350080959d3323990b3d230a8bc4e..bb93fc91f6eeb4aba3b059ccd8b2623b35f2a852 100755 (executable)
@@ -249,6 +249,19 @@ function TEST_rados_put_get_shec() {
     ceph osd erasure-code-profile rm $profile
 }
 
+function chunk_size() {
+    local chunk_size=$(ceph-conf --show-config-value osd_pool_erasure_code_stripe_unit)
+    if [ "$chunk_size" -eq 0 ]; then
+      local ec_opt=$(ceph-conf --show-config-value osd_pool_default_flag_ec_optimizations)
+      if [ "$ec_opt" = "true" ]; then
+        chunk_size=$((16 * 1024))
+      else 
+        chunk_size=$((4 * 1024))
+      fi
+    fi
+    echo $chunk_size
+}
+
 function TEST_alignment_constraints() {
     local payload=ABC
     echo "$payload" > $dir/ORIGINAL
@@ -257,7 +270,7 @@ function TEST_alignment_constraints() {
     # imposed by the stripe width
     # See http://tracker.ceph.com/issues/8622
     #
-    local stripe_unit=$(ceph-conf --show-config-value osd_pool_erasure_code_stripe_unit)
+    local stripe_unit=$(chunk_size)
     eval local $(ceph osd erasure-code-profile get myprofile | grep k=)
     local block_size=$((stripe_unit * k - 1))
     dd if=/dev/zero of=$dir/ORIGINAL bs=$block_size count=2
@@ -266,10 +279,6 @@ function TEST_alignment_constraints() {
     rm $dir/ORIGINAL
 }
 
-function chunk_size() {
-    echo $(ceph-conf --show-config-value osd_pool_erasure_code_stripe_unit)
-}
-
 #
 # By default an object will be split in two (k=2) with the first part
 # of the object in the first OSD of the up set and the second part in
@@ -333,5 +342,5 @@ function TEST_chunk_mapping() {
 main test-erasure-code "$@"
 
 # Local Variables:
-# compile-command: "cd ../.. ; make -j4 && test/erasure-code/test-erasure-code.sh"
-# End:
+# compile-command: "cd ../..; make -j4 && test/erasure-code/test-erasure-code.sh"
+# End:
\ No newline at end of file
index 2c337fcea70721b73abd548bb9657fcd15300bb1..dff5ecfff1f32fe215761c3a4fc983e7a3a609ca 100644 (file)
@@ -21,10 +21,15 @@ options:
     stripe for erasure coded pools. Every object of size S
     will be stored as N stripes, with each data chunk
     receiving ``stripe unit`` bytes. Each stripe of ``N *
-    stripe unit`` bytes will be encoded/decoded
-    individually. This option can is overridden by the
-    ``stripe_unit`` setting in an erasure code profile.
-  default: 4_K
+    stripe unit`` bytes will be encoded/decoded individually. 
+    A value of 0 causes the code to select either a 4KB or 16KB
+    stripe_unit depending on whether ``allow_ec_optimizations`` 
+    is enabled.  If enabled, ``stripe unit`` is set to 16KB, otherwise it 
+    is set to 4KB. This option can be overridden by the ``stripe_unit``
+    setting in an erasure code profile.
+  long_desc: A value of 0 causes the code to select either a 4KB or 16KB stripe_unit 
+    depending on whether allow_ec_optimizations is enabled.
+  default: 0
   services:
   - mon
 - name: osd_pool_default_crimson
index bd7f60594b3124a1d7a81cb3133a317fda692c7c..f9cbfe2616da20790299aad976c8a60c30d763cc 100644 (file)
@@ -7832,6 +7832,17 @@ int OSDMonitor::prepare_pool_stripe_width(const unsigned pool_type,
        break;
       uint32_t data_chunks = erasure_code->get_data_chunk_count();
       uint32_t stripe_unit = g_conf().get_val<Option::size_t>("osd_pool_erasure_code_stripe_unit");
+
+      if (stripe_unit == 0) {
+        if (((erasure_code->get_supported_optimizations() & 
+              ErasureCodeInterface::FLAG_EC_PLUGIN_OPTIMIZED_SUPPORTED) != 0) &&
+            (cct->_conf.get_val<bool>("osd_pool_default_flag_ec_optimizations"))) {
+            stripe_unit = 16 * 1024;
+        } else {
+          stripe_unit = 4 * 1024;
+        }
+      } 
+    
       auto it = profile.find("stripe_unit");
       if (it != profile.end()) {
        string err_str;
index 9ffd9a7e0041f0f7593a37b7b0a02088a3907f4b..e20943d515cec0a41b203180183511330647952d 100644 (file)
@@ -617,7 +617,7 @@ TEST(ErasureCodeLrc, encode_decode)
   profile["layers"] = description_string;
   EXPECT_EQ(0, lrc.init(profile, &cerr));
   EXPECT_EQ(4U, lrc.get_data_chunk_count());
-  unsigned int chunk_size = g_conf().get_val<Option::size_t>("osd_pool_erasure_code_stripe_unit");
+  unsigned int chunk_size = 4096;
   unsigned int stripe_width = lrc.get_data_chunk_count() * chunk_size;
   EXPECT_EQ(chunk_size, lrc.get_chunk_size(stripe_width));
   shard_id_set want_to_encode;
@@ -757,7 +757,7 @@ TEST(ErasureCodeLrc, encode_decode_2)
   profile["layers"] = description_string;
   EXPECT_EQ(0, lrc.init(profile, &cerr));
   EXPECT_EQ(4U, lrc.get_data_chunk_count());
-  unsigned int chunk_size = g_conf().get_val<Option::size_t>("osd_pool_erasure_code_stripe_unit");
+  unsigned int chunk_size = 4096;
   unsigned int stripe_width = lrc.get_data_chunk_count() * chunk_size;
   EXPECT_EQ(chunk_size, lrc.get_chunk_size(stripe_width));
   shard_id_set want_to_encode;