From 62f376ee32bad8b77620c59b5bd472e861a3d0f7 Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 17 May 2023 19:44:10 +0100 Subject: [PATCH] cloud_storage: improved debug on partition manifest parse error - Log at WARN, so that we actually get the message on prod systems - hexdump the region around the parse error, rather than the first bytes in the manifest. This is more important than it used to be, now that we have admin API for loading in arbitrary manifests, which can fail. (cherry picked from commit abbd6eadb8f1abbfe61ea75a66da745197e27a36) --- src/v/cloud_storage/partition_manifest.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/v/cloud_storage/partition_manifest.cc b/src/v/cloud_storage/partition_manifest.cc index c304c312bc71..b9f829e6d84c 100644 --- a/src/v/cloud_storage/partition_manifest.cc +++ b/src/v/cloud_storage/partition_manifest.cc @@ -1114,7 +1114,15 @@ ss::future<> partition_manifest::update(iobuf buf) { } else { rapidjson::ParseErrorCode e = reader.GetParseErrorCode(); size_t o = reader.GetErrorOffset(); - vlog(cst_log.debug, "Failed to parse manifest: {}", buf.hexdump(2048)); + + // Hexdump 1kb region around the bad manifest + buf.trim_front(o - std::min(size_t{512}, o)); + vlog( + cst_log.warn, + "Failed to parse manifest at 0x{:08x}: {}", + o, + buf.hexdump(1024)); + throw std::runtime_error(fmt_with_ctx( fmt::format, "Failed to parse topic manifest {}: {} at offset {}",