From: Igor Fedotov Date: Thu, 4 Sep 2025 17:37:21 +0000 (+0300) Subject: test/bluefs: add cases for wal v2 envelope header mislocation. X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=47422b39aef3428d5011431722bc0c39d3b62ab3;p=ceph.git test/bluefs: add cases for wal v2 envelope header mislocation. Signed-off-by: Igor Fedotov (cherry picked from commit 46f6ffcd9140bfeda499af4ac2f143a1ae9cf994) (from https://github.com/ceph/ceph/pull/65275) --- diff --git a/src/test/objectstore/test_bluefs.cc b/src/test/objectstore/test_bluefs.cc index 297892c6655f..c19b6c5f5d7d 100644 --- a/src/test/objectstore/test_bluefs.cc +++ b/src/test/objectstore/test_bluefs.cc @@ -1176,6 +1176,55 @@ TEST_F(BlueFS_wal, wal_v2_check) fs.umount(); } +TEST_F(BlueFS_wal, wal_v2_check_split_header) +{ + // Check if wal v2 envelope header is properly located + // when FileWrite'r buffer is exhausted. + // + ConfSaver conf(g_ceph_context->_conf); + conf.SetVal("bluefs_min_flush_size", "65536"); + conf.SetVal("bluefs_wal_envelope_mode", "true"); + conf.SetVal("bluefs_alloc_size", "8192"); + conf.ApplyChanges(); + + Create(1048576 * 256, 1048576 * 128, 1048576 * 64); + ASSERT_EQ(0, fs.mount()); + + bufferlist content; + many_small_writes("db.wal", "wal1.log", content, 4076 + 4077, 4076, 4077); + fs.umount(); + fs.mount(); + bufferlist read_content; + many_small_reads("db.wal", "wal1.log", read_content, 4076 + 4077, 4076, 4077); + ASSERT_EQ(content, read_content); + fs.umount(); +} + +TEST_F(BlueFS_wal, wal_v2_check_split_header_small_alloc) +{ + // Check if wal v2 envelope header is properly located + // when FileWrite'r buffer is exhausted. + // Case for single 4K page buffer. + // + ConfSaver conf(g_ceph_context->_conf); + conf.SetVal("bluefs_min_flush_size", "65536"); + conf.SetVal("bluefs_wal_envelope_mode", "true"); + conf.SetVal("bluefs_alloc_size", "4096"); + conf.ApplyChanges(); + + Create(1048576 * 256, 1048576 * 128, 1048576 * 64); + ASSERT_EQ(0, fs.mount()); + + bufferlist content; + many_small_writes("db.wal", "wal1.log", content, 4076 + 4077, 4076, 4077); + fs.umount(); + fs.mount(); + bufferlist read_content; + many_small_reads("db.wal", "wal1.log", read_content, 4076 + 4077, 4076, 4077); + ASSERT_EQ(content, read_content); + fs.umount(); +} + TEST_F(BlueFS_wal, wal_v2_check_feature) { SKIP_JENKINS();