]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/rgw/datalog: test for trim_entries with max_marker
authorOguzhan Ozmen <oozmen@bloomberg.net>
Tue, 19 May 2026 23:43:58 +0000 (23:43 +0000)
committerOguzhan Ozmen <oozmen@bloomberg.net>
Wed, 20 May 2026 13:56:05 +0000 (13:56 +0000)
Verify that DataLogBackends::trim_entries does not crash when called
with max_marker() on a single-generation cluster. The bug causes
upper_bound(head_gen)->second to dereference end() (SIGSEGV)
because the only break condition checked be->gen_id == target_gen,
which is never true when target_gen is UINT64_MAX as encoded by
max_marker() and the cluster has only generation 0.

Signed-off-by: Oguzhan Ozmen <oozmen@bloomberg.net>
src/test/rgw/test_datalog.cc

index 89b70e5d876c9d6cfb4116e8e69329cd5188c876..6dbb985f2df6892520ba847f3907efbf7b6d3813 100644 (file)
@@ -442,6 +442,18 @@ CORO_TEST_F(DataLogBulky, BulkyCycleRecovery, DataLogBulky) {
   co_return;
 }
 
+// trim_entries with max_marker() must not crash on a single-generation cluster.
+// Without the fix, the loop increment would call upper_bound(head_gen)->second,
+// dereferencing end() and causing a SIGSEGV.
+CORO_TEST_F(DataLogBulky, TrimWithMaxMarker, DataLogBulky) {
+  for (const auto& bg : bulky) {
+    co_await add_entry(dpp(), bg);
+  }
+  co_await renew_entries(dpp());
+  co_await datalog->trim_entries(dpp(), 0, datalog->max_marker());
+  co_return;
+}
+
 CORO_TEST_F(DataLogBulky, BulkySemaphoresRecovery, DataLogBulky) {
   for (const auto& bg : bulky) {
     co_await rados().execute(sem_set_oid(bg), loc(),