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

cst/inv: Minor fixes for issues found during scrubber integration #23240

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
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
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/---",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this how the real path looks? i suppose this is the cluster uuid? don't we still include the hash prefix too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I discovered similar paths while running ducktape test:

d10492a6-2408-418e-9b6b-051697c5255b/kafka/topic-kppbtczbbq/2_22/429-500-1153657-1-v1.log.1

and looking at the code leads to https://github.com/redpanda-data/redpanda/blob/dev/src/v/cloud_storage/remote_path_provider.cc#L143 and https://github.com/redpanda-data/redpanda/blob/dev/src/v/cloud_storage/segment_path_utils.cc#L20

If there is a label it looks like we use the cluster uuid, otherwise a hash prefix

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