Create flags for enabling auto index creation

This commit is contained in:
gvolfing 2024-03-19 15:00:44 +01:00
parent 2ac649f3b5
commit be32e8893d
5 changed files with 40 additions and 2 deletions

View File

@ -119,6 +119,14 @@ modifications:
value: "false"
override: true
- name: "storage_enable_automatic_label_index_creation"
value: "false"
override: true
- name: "storage_enable_automatic_edge_type_index_creation"
value: "false"
override: true
- name: "query_callable_mappings_path"
value: "/etc/memgraph/apoc_compatibility_mappings.json"
override: true

View File

@ -131,6 +131,14 @@ DEFINE_uint64(storage_recovery_thread_count,
DEFINE_bool(storage_enable_schema_metadata, false,
"Controls whether metadata should be collected about the resident labels and edge types.");
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_bool(storage_enable_automatic_label_index_creation, false,
"Controls whether label indexes on vertices should be created automatically.");
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_bool(storage_enable_automatic_edge_type_index_creation, false,
"Controls whether edge-type indexes on relationships should be created automatically.");
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_bool(storage_delta_on_identical_property_update, true,
"Controls whether updating a property with the same value should create a delta object.");

View File

@ -85,6 +85,10 @@ DECLARE_uint64(storage_recovery_thread_count);
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DECLARE_bool(storage_enable_schema_metadata);
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DECLARE_bool(storage_enable_automatic_label_index_creation);
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DECLARE_bool(storage_enable_automatic_edge_type_index_creation);
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DECLARE_bool(storage_delta_on_identical_property_update);
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)

View File

@ -333,8 +333,18 @@ int main(int argc, char **argv) {
.wal_directory = FLAGS_data_directory + "/rocksdb_wal"},
.salient.items = {.properties_on_edges = FLAGS_storage_properties_on_edges,
.enable_schema_metadata = FLAGS_storage_enable_schema_metadata,
.enable_label_index_auto_creation = FLAGS_storage_enable_automatic_label_index_creation,
.enable_edge_type_index_auto_creation =
FLAGS_storage_properties_on_edges ? FLAGS_storage_enable_automatic_edge_type_index_creation
: false,
.delta_on_identical_property_update = FLAGS_storage_delta_on_identical_property_update},
.salient.storage_mode = memgraph::flags::ParseStorageMode()};
if (db_config.salient.items.enable_edge_type_index_auto_creation && !db_config.salient.items.properties_on_edges) {
spdlog::warn(
"Automatic index creation on edge-types has been set but properties on edges are disabled. This will "
"implicitly disallow automatic edge-type index creation. If you wish to use automatic edge-type index "
"creation, enable properties on edges as well.");
}
spdlog::info("config recover on startup {}, flags {} {}", db_config.durability.recover_on_startup,
FLAGS_storage_recover_on_startup, FLAGS_data_recovery_on_startup);
memgraph::utils::Scheduler jemalloc_purge_scheduler;

View File

@ -37,6 +37,8 @@ struct SalientConfig {
struct Items {
bool properties_on_edges{true};
bool enable_schema_metadata{false};
bool enable_label_index_auto_creation{false};
bool enable_edge_type_index_auto_creation{false};
bool delta_on_identical_property_update{true};
friend bool operator==(const Items &lrh, const Items &rhs) = default;
} items;
@ -45,13 +47,19 @@ struct SalientConfig {
};
inline void to_json(nlohmann::json &data, SalientConfig::Items const &items) {
data = nlohmann::json{{"properties_on_edges", items.properties_on_edges},
{"enable_schema_metadata", items.enable_schema_metadata}};
data = nlohmann::json{
{"properties_on_edges", items.properties_on_edges},
{"enable_schema_metadata", items.enable_schema_metadata},
{"enable_label_index_auto_creation", items.enable_label_index_auto_creation},
{"enable_edge_type_index_auto_creation", items.enable_edge_type_index_auto_creation},
};
}
inline void from_json(const nlohmann::json &data, SalientConfig::Items &items) {
data.at("properties_on_edges").get_to(items.properties_on_edges);
data.at("enable_schema_metadata").get_to(items.enable_schema_metadata);
data.at("enable_label_index_auto_creation").get_to(items.enable_label_index_auto_creation);
data.at("enable_edge_type_index_auto_creation").get_to(items.enable_edge_type_index_auto_creation);
}
inline void to_json(nlohmann::json &data, SalientConfig const &config) {