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>
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
# 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
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
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
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
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;
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;
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;