Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jaykorean committed Aug 28, 2024
1 parent 61a6211 commit f0d3571
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions db/compaction/compaction_service_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,24 @@ class MyTestCompactionService : public CompactionService {
table_properties_collector_factories_(
std::move(table_properties_collector_factories)) {
// Register Compaction Filter
const auto& library = ObjectLibrary::Default();
library->AddFactory<CompactionFilter>(
static std::once_flag once;
std::call_once(once, [&]() {
ObjectRegistry::Default()->AddLibrary("MyTestCompactionService",
RegisterCompactionFilter, "");
});
}

static int RegisterCompactionFilter(ObjectLibrary& library,
const std::string& /*arg*/) {
library.AddFactory<CompactionFilter>(
PartialDeleteCompactionFilter::kClassName(),
[](const std::string& /*uri*/, std::unique_ptr<CompactionFilter>*,
std::string* /* errmsg */) {
return new PartialDeleteCompactionFilter();
static PartialDeleteCompactionFilter compactionFilter;
return &compactionFilter;
});
size_t num_types;
return static_cast<int>(library.GetFactoryCount(&num_types));
}

static const char* kClassName() { return "MyTestCompactionService"; }
Expand Down

0 comments on commit f0d3571

Please sign in to comment.