Skip to content

Commit

Permalink
schema_registry: subject_versions_has_any_of inc_del
Browse files Browse the repository at this point in the history
Add support to `store::subject_versions_has_any_of` for including
deleted subject versions.
  • Loading branch information
pgellert committed Jul 5, 2024
1 parent 26b6202 commit 1edb81a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/v/pandaproxy/schema_registry/sharded_store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ ss::future<bool> sharded_store::is_referenced(subject sub, schema_version ver) {
// Find whether any subject version reference any of the schema
co_return co_await _store.map_reduce0(
[refs{std::move(references)}](store& s) {
return s.subject_versions_has_any_of(refs);
return s.subject_versions_has_any_of(refs, include_deleted::no);
},
false,
std::logical_or<>{});
Expand Down
12 changes: 7 additions & 5 deletions src/v/pandaproxy/schema_registry/store.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,13 @@ class store {
return has_ids;
}

bool subject_versions_has_any_of(const schema_id_set& ids) {
return absl::c_any_of(_subjects, [&ids](const auto& s) {
return absl::c_any_of(s.second.versions, [&ids, &s](const auto& v) {
return !s.second.deleted && ids.contains(v.id);
});
bool subject_versions_has_any_of(
const schema_id_set& ids, include_deleted inc_del) {
return absl::c_any_of(_subjects, [&ids, inc_del](const auto& s) {
return absl::c_any_of(
s.second.versions, [&ids, &s, inc_del](const auto& v) {
return (inc_del || !s.second.deleted) && ids.contains(v.id);
});
});
}

Expand Down

0 comments on commit 1edb81a

Please sign in to comment.