Skip to content

[v25.3.x] INC-1235 storage: keep segment_set formatting bounded under fmt - #31504

Merged
pgellert merged 1 commit into
redpanda-data:v25.3.xfrom
vbotbuildovich:ai-backport-pr-31500-v25.3.x-1786367074
Aug 11, 2026
Merged

[v25.3.x] INC-1235 storage: keep segment_set formatting bounded under fmt#31504
pgellert merged 1 commit into
redpanda-data:v25.3.xfrom
vbotbuildovich:ai-backport-pr-31500-v25.3.x-1786367074

Conversation

@vbotbuildovich

Copy link
Copy Markdown
Collaborator

Backport of PR #31500

  • Command: git cherry-pick -x c4d8e60
  • Commits backported: 1
  • Conflicts resolved: 1
  • Commits skipped (already on target): 0
  • Backport branch: ai-backport-pr-31500-v25.3.x-1786367074

Conflict details

  • c4d8e60 (src/v/storage/segment_set.cc): include-block conflict — v25.3.x already has #include <fmt/format.h> while the commit added both <fmt/format.h> and <fmt/ostream.h>; resolved by keeping the existing <fmt/format.h> and adding <fmt/ostream.h> (required by the new fmt::print(o, "{}", s) in operator<<).
  • c4d8e60 (src/v/storage/tests/segment_set_test.cc): include-block conflict — v25.3.x has #include <ranges> where the commit added #include <sstream>; resolved by keeping both in alphabetical order (<sstream> is needed by the new format_is_bounded test's std::ostringstream).

Both conflicts were confined to include blocks. The functional payload of the
commit — segment_set::format_to, the explicit fmt::formatter<storage::segment_set>
full specialization in segment_set.h, the operator<< delegation, and the new
format_is_bounded gtest plus its @fmt Bazel dep — applied unchanged, so the
backported diff is semantically identical to the source commit.

Since the fmt 9 upgrade, formatter resolution for segment_set selects
fmt/ranges.h's range formatter over the ostream operator<<, printing
every segment and silently bypassing the 8-segment truncation added in
2023 for this same problem. On partitions with thousands of segments,
formatting a log handle (e.g. "Removing: {}" in log_manager::remove)
then builds a multi-megabyte string in one contiguous fmt buffer, which
can fail allocation on a fragmented shard and abort the process; the
allocation failure report is itself suppressed by the logger's
re-entrancy silencer, so such crashes appear as bare SIGABRTs. Move the
truncation into a format_to member and add an explicit full
fmt::formatter specialization, which takes precedence over any partial
specialization, so no future fmt upgrade or include change can route
around the bound; operator<< now delegates to it. The new gtest covers
the fmt dispatch path (the one that regressed) and asserts ostream
output stays identical.

(cherry picked from commit c4d8e60)
@vbotbuildovich vbotbuildovich added this to the v25.3.x-next milestone Aug 10, 2026
@vbotbuildovich vbotbuildovich added the kind/backport PRs targeting a stable branch label Aug 10, 2026
@pgellert pgellert self-assigned this Aug 10, 2026
@vbotbuildovich

Copy link
Copy Markdown
Collaborator Author

CI test results

test results on build#88477
test_status test_class test_method test_arguments test_kind job_url passed reason test_history
FAIL MasterTestSuite quota_manager_fetch_throttling unit https://buildkite.com/redpanda/redpanda/builds/88477#019febca-a182-4db6-8b92-c218e31b9383 0/1
FLAKY(PASS) GroupMetricsTest test_topic_recreation null integration https://buildkite.com/redpanda/redpanda/builds/88477#019febe5-de03-4241-84c2-c3e11ff61294 10/11 Test PASSES after retries.No significant increase in flaky rate(baseline=0.0000, p0=1.0000, reject_threshold=0.0100. adj_baseline=0.1000, p1=0.3487, trust_threshold=0.5000) https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=GroupMetricsTest&test_method=test_topic_recreation

@pgellert
pgellert enabled auto-merge August 10, 2026 16:35
@pgellert
pgellert merged commit 88f6fd8 into redpanda-data:v25.3.x Aug 11, 2026
17 checks passed
@tyson-redpanda tyson-redpanda modified the milestones: v25.3.x-next, v25.3.16 Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build area/redpanda kind/backport PRs targeting a stable branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants