Skip to content

Commit

Permalink
Merge pull request #1656
Browse files Browse the repository at this point in the history
Don't send dynamic type information to connecting sources
  • Loading branch information
lava authored May 20, 2021
2 parents b1c4bf7 + f985e3b commit f2f0240
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 88 deletions.
8 changes: 8 additions & 0 deletions changelog/unreleased/breaking-changes/1656.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Schemas are no longer implicitly shared between sources, i.e., an `import`
process importing data with a custom schema will no longer affect other
sources started at a later point in time. Schemas known to the VAST server
process are still available to all `import` processes. We do not expect this
change to have a real-world impact, but it could break setups where some
sources have been installed on hosts without their own schema files, the
VAST server did not have up-to-date schema files, and other sources were
(ab)used to provide the latest type information.
File renamed without changes.
5 changes: 0 additions & 5 deletions libvast/src/system/spawn_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ spawn_importer(node_actor::stateful_pointer<node_state> self,
= make_transforms(transforms_location::server_import, args.inv.options);
if (!transforms)
return transforms.error();
// TODO: Remove this check once ch25395 is implemented.
if (!transforms->empty())
return caf::make_error(ec::invalid_configuration, "import transformations "
"are currently not "
"permitted");
if (!archive)
return caf::make_error(ec::missing_component, "archive");
if (!index)
Expand Down
4 changes: 0 additions & 4 deletions libvast/src/system/spawn_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ spawn_source(node_actor::stateful_pointer<node_state> self,
= make_transforms(transforms_location::server_import, args.inv.options);
if (!transforms)
return transforms.error();
// TODO: Remove this check once ch25395 is implemented.
if (!transforms->empty())
return caf::make_error(ec::invalid_configuration,
"import transformations currently not permitted");
auto [accountant, importer, type_registry]
= self->state.registry
.find<accountant_actor, importer_actor, type_registry_actor>();
Expand Down
12 changes: 0 additions & 12 deletions libvast/src/system/type_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ void type_registry_state::insert(vast::type layout) {

type_set type_registry_state::types() const {
auto result = type_set{};
for (const auto& [_, v] : data)
for (const auto& x : v)
result.insert(x);
for (const auto& x : configuration_schema)
result.insert(x);
return result;
Expand Down Expand Up @@ -190,15 +187,6 @@ type_registry(type_registry_actor::stateful_pointer<type_registry_state> self,
[=](caf::unit_t&, table_slice x) { self->state.insert(x.layout()); });
return result.inbound_slot();
},
[self](atom::put, vast::type x) {
VAST_TRACE_SCOPE("{} tries to add {}", self, VAST_ARG("type", x.name()));
self->state.insert(std::move(x));
},
[self](atom::put, vast::schema x) {
VAST_TRACE_SCOPE("{} tries to add {}", self, VAST_ARG("schema", x));
for (auto& type : x)
self->state.insert(std::move(type));
},
[self](atom::get) {
VAST_TRACE_SCOPE("{} retrieves a list of all known types", self);
return self->state.types();
Expand Down
63 changes: 0 additions & 63 deletions libvast/test/system/type_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,6 @@ vast::table_slice make_data(const vast::record_type& layout, Ts&&... ts) {
return builder->finish();
}

const vast::record_type mock_layout_a = vast::record_type{
{"a", vast::string_type{}},
{"b", vast::count_type{}},
{"c", vast::real_type{}},
}.name("mock");

vast::table_slice make_data_a(std::string a, vast::count b, vast::real c) {
return make_data(mock_layout_a, a, b, c);
}

const vast::record_type mock_layout_b = vast::record_type{
{"a", vast::string_type{}},
{"b", vast::count_type{}},
{"c", vast::real_type{}},
{"d", vast::string_type{}},
}.name("mock");

vast::table_slice
make_data_b(std::string a, vast::count b, vast::real c, std::string d) {
return make_data(mock_layout_b, a, b, c, d);
}

} // namespace

struct fixture : fixtures::deterministic_actor_system_and_events {
Expand Down Expand Up @@ -95,47 +73,6 @@ struct fixture : fixtures::deterministic_actor_system_and_events {

FIXTURE_SCOPE(type_registry_tests, fixture)

TEST(type_registry) {
MESSAGE("importing mock data");
{
auto slices_a = std::vector{1000, make_data_a("1", 2u, 3.0)};
auto slices_b = std::vector{1000, make_data_b("1", 2u, 3.0, "4")};
vast::detail::spawn_container_source(sys, std::move(slices_a), aut);
vast::detail::spawn_container_source(sys, std::move(slices_b), aut);
run();
CHECK_EQUAL(state().data.size(), 1u);
}
MESSAGE("retrieving layouts");
{
size_t size = -1;
self->send(aut, atom::get_v);
run();
bool done = false;
self
->do_receive([&](vast::type_set result) {
size = result.size();
done = true;
})
.until(done);
CHECK_EQUAL(size, 2u);
}
MESSAGE("retrieving layouts");
{
size_t size = -1;
self->send(aut, atom::get_v);
run();
bool done = false;
self
->do_receive([&](vast::type_set result) {
size = result.size();
done = true;
})
.until(done);
CHECK_EQUAL(size, 2u);
}
self->send_exit(aut, caf::exit_reason::user_shutdown);
}

TEST(taxonomies) {
MESSAGE("setting a taxonomy");
auto c1 = concepts_map{{{"foo", {"", {"a.fo0", "b.foO", "x.foe"}, {}}},
Expand Down
4 changes: 0 additions & 4 deletions libvast/vast/system/actors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,6 @@ using archive_actor = typed_actor_fwd<
using type_registry_actor = typed_actor_fwd<
// The internal telemetry loop of the TYPE REGISTRY.
caf::reacts_to<atom::telemetry>,
// Registers the given type.
caf::reacts_to<atom::put, vast::type>,
// Registers all types in the given schema.
caf::reacts_to<atom::put, vast::schema>,
// Retrieves all known types.
caf::replies_to<atom::get>::with<type_set>,
// Registers the given taxonomies.
Expand Down

0 comments on commit f2f0240

Please sign in to comment.