[v25.3.x] INC-1235 storage: keep segment_set formatting bounded under fmt - #31504
Merged
pgellert merged 1 commit intoAug 11, 2026
Conversation
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)
pgellert
approved these changes
Aug 10, 2026
Collaborator
Author
CI test resultstest results on build#88477
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of PR #31500
Conflict details
#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 newfmt::print(o, "{}", s)inoperator<<).#include <ranges>where the commit added#include <sstream>; resolved by keeping both in alphabetical order (<sstream>is needed by the newformat_is_boundedtest'sstd::ostringstream).Both conflicts were confined to include blocks. The functional payload of the
commit —
segment_set::format_to, the explicitfmt::formatter<storage::segment_set>full specialization in
segment_set.h, theoperator<<delegation, and the newformat_is_boundedgtest plus its@fmtBazel dep — applied unchanged, so thebackported diff is semantically identical to the source commit.