Skip to content

Commit

Permalink
Merge pull request #23240 from abhijat/feat/inv-scrub/misc-fixes
Browse files Browse the repository at this point in the history
cst/inv: Minor fixes for issues found during scrubber integration
  • Loading branch information
abhijat authored Sep 9, 2024
2 parents 9fe1109 + d709a8f commit 64c8390
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/v/cloud_storage/inventory/inv_consumer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ namespace ranges = std::ranges;
namespace views = std::views;

namespace {
// hash-string/ns/tp/partition_rev/.*
const RE2 path_expr{"^[[:xdigit:]]+/(.*?)/(.*?)/(\\d+)_\\d+/.*?"};
// hash-string/ns/tp/partition_rev/.* OR
// cluster-uuid/ns/tp/partition_rev/.*
const RE2 path_expr{"^[[:xdigit:]-]+/(.*?)/(.*?)/(\\d+)_\\d+/.*?"};

// Holds hashes for a given NTP in memory before they will be flushed to disk.
// One of these structures is held per NTP in a map keyed by the NTP itself.
Expand Down Expand Up @@ -113,7 +114,7 @@ inventory_consumer::process_paths(fragmented_vector<ss::sstring> paths) {

void inventory_consumer::process_path(ss::sstring path) {
if (auto maybe_ntp = ntp_from_path(path);
_ntps.contains(maybe_ntp.value())) {
maybe_ntp.has_value() && _ntps.contains(maybe_ntp.value())) {
const auto& ntp = maybe_ntp.value();
auto hash = xxhash_64(path.data(), path.size());

Expand Down
2 changes: 2 additions & 0 deletions src/v/cloud_storage/inventory/tests/inv_consumer_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ TEST(Consumer, ParseNTPFromPath) {
std::vector<p> test_data{
{"a0a6eeb8/kafka/topic-x/999_24/178-188-1574137-1-v1.log.1",
std::make_optional(make_ntp("kafka", "topic-x", 999))},
{"d10492a6-2408-418e-9b6b-051697c5255b/k/t/1_24/---",
std::make_optional(make_ntp("k", "t", 1))},
{"a/k/t/1_24/---", std::make_optional(make_ntp("k", "t", 1))},
// Bad hex m
{"m/k/t/1_24/---", std::nullopt},
Expand Down

0 comments on commit 64c8390

Please sign in to comment.