Skip to content

Commit

Permalink
cst/inv: Allow uuids in segment expression match
Browse files Browse the repository at this point in the history
Since the segment prefix has been changed recently to either contain
cluster uuid or the regular hash, the path matching expression is
adjusted to also accept UUID.
  • Loading branch information
abhijat committed Sep 9, 2024
1 parent fbe571e commit d709a8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 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
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 d709a8f

Please sign in to comment.