Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v21.11.x] cloud_storage: check that we have serialized the whole manifest #6510

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/v/cloud_storage/manifest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ serialized_json_stream manifest::serialize() const {
iobuf_ostreambuf obuf(serialized);
std::ostream os(&obuf);
serialize(os);
if (!os.good()) {
throw std::runtime_error(fmt_with_ctx(
fmt::format,
"could not serialize partition manifest {}",
get_manifest_path()));
}
size_t size_bytes = serialized.size_bytes();
return {
.stream = make_iobuf_input_stream(std::move(serialized)),
Expand Down Expand Up @@ -552,6 +558,12 @@ serialized_json_stream topic_manifest::serialize() const {
iobuf_ostreambuf obuf(serialized);
std::ostream os(&obuf);
serialize(os);
if (!os.good()) {
throw std::runtime_error(fmt_with_ctx(
fmt::format,
"could not serialize topic manifest {}",
get_manifest_path()));
}
size_t size_bytes = serialized.size_bytes();
return {
.stream = make_iobuf_input_stream(std::move(serialized)),
Expand Down