Resolve clang-tidy error
This commit is contained in:
parent
12b4ec1589
commit
695bb343f1
@ -27,7 +27,7 @@ namespace memgraph::glue {
|
||||
memgraph::query::TypedValue ToTypedValue(const Value &value) {
|
||||
switch (value.type()) {
|
||||
case Value::Type::Null:
|
||||
return memgraph::query::TypedValue();
|
||||
return {};
|
||||
case Value::Type::Bool:
|
||||
return memgraph::query::TypedValue(value.ValueBool());
|
||||
case Value::Type::Int:
|
||||
|
@ -100,9 +100,11 @@ void KVStore::iterator::SetInvalid() {}
|
||||
|
||||
bool KVStore::iterator::IsValid() { return false; }
|
||||
|
||||
size_t KVStore::Size(const std::string &prefix) { return 0; }
|
||||
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
|
||||
size_t KVStore::Size(const std::string & /*prefix*/) const { return 0; }
|
||||
|
||||
bool KVStore::CompactRange(const std::string &begin_prefix, const std::string &end_prefix) {
|
||||
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
|
||||
bool KVStore::CompactRange(const std::string & /*begin_prefix*/, const std::string & /*end_prefix*/) {
|
||||
LOG_FATAL(
|
||||
"Unsupported operation (KVStore::Compact) -- this is a "
|
||||
"dummy kvstore");
|
||||
|
@ -139,16 +139,21 @@ DEFINE_VALIDATED_int32(bolt_port, 7687, "Port on which the Bolt server should li
|
||||
DEFINE_VALIDATED_int32(monitoring_port, 7444,
|
||||
"Port on which the websocket server for Memgraph monitoring should listen.",
|
||||
FLAG_IN_RANGE(0, std::numeric_limits<uint16_t>::max()));
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_VALIDATED_int32(bolt_num_workers, std::max(std::thread::hardware_concurrency(), 1U),
|
||||
"Number of workers used by the Bolt server. By default, this will be the "
|
||||
"number of processing units available on the machine.",
|
||||
FLAG_IN_RANGE(1, INT32_MAX));
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_VALIDATED_int32(bolt_session_inactivity_timeout, 1800,
|
||||
"Time in seconds after which inactive Bolt sessions will be "
|
||||
"closed.",
|
||||
FLAG_IN_RANGE(1, INT32_MAX));
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_string(bolt_cert_file, "", "Certificate file which should be used for the Bolt server.");
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_string(bolt_key_file, "", "Key file which should be used for the Bolt server.");
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_string(bolt_server_name_for_init, "",
|
||||
"Server name which the database should send to the client in the "
|
||||
"Bolt INIT message.");
|
||||
@ -156,8 +161,11 @@ DEFINE_string(bolt_server_name_for_init, "",
|
||||
// General purpose flags.
|
||||
// NOTE: The `data_directory` flag must be the same here and in
|
||||
// `mg_import_csv`. If you change it, make sure to change it there as well.
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_string(data_directory, "mg_data", "Path to directory in which to save all permanent data.");
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_HIDDEN_string(log_link_basename, "", "Basename used for symlink creation to the last log file.");
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_uint64(memory_warning_threshold, 1024,
|
||||
"Memory warning threshold, in MB. If Memgraph detects there is "
|
||||
"less available RAM it will log a warning. Set to 0 to "
|
||||
@ -167,30 +175,41 @@ DEFINE_uint64(memory_warning_threshold, 1024,
|
||||
DEFINE_bool(allow_load_csv, true, "Controls whether LOAD CSV clause is allowed in queries.");
|
||||
|
||||
// Storage flags.
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_VALIDATED_uint64(storage_gc_cycle_sec, 30, "Storage garbage collector interval (in seconds).",
|
||||
FLAG_IN_RANGE(1, 24 * 3600));
|
||||
// NOTE: The `storage_properties_on_edges` flag must be the same here and in
|
||||
// `mg_import_csv`. If you change it, make sure to change it there as well.
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_bool(storage_properties_on_edges, false, "Controls whether edges have properties.");
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_bool(storage_recover_on_startup, false, "Controls whether the storage recovers persisted data on startup.");
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_VALIDATED_uint64(storage_snapshot_interval_sec, 0,
|
||||
"Storage snapshot creation interval (in seconds). Set "
|
||||
"to 0 to disable periodic snapshot creation.",
|
||||
FLAG_IN_RANGE(0, 7 * 24 * 3600));
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_bool(storage_wal_enabled, false,
|
||||
"Controls whether the storage uses write-ahead-logging. To enable "
|
||||
"WAL periodic snapshots must be enabled.");
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_VALIDATED_uint64(storage_snapshot_retention_count, 3, "The number of snapshots that should always be kept.",
|
||||
FLAG_IN_RANGE(1, 1000000));
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_VALIDATED_uint64(storage_wal_file_size_kib, memgraph::storage::Config::Durability().wal_file_size_kibibytes,
|
||||
"Minimum file size of each WAL file.", FLAG_IN_RANGE(1, 1000 * 1024));
|
||||
"Minimum file size of each WAL file.",
|
||||
FLAG_IN_RANGE(1, static_cast<unsigned long>(1000) * 1024));
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_VALIDATED_uint64(storage_wal_file_flush_every_n_tx,
|
||||
memgraph::storage::Config::Durability().wal_file_flush_every_n_tx,
|
||||
"Issue a 'fsync' call after this amount of transactions are written to the "
|
||||
"WAL file. Set to 1 for fully synchronous operation.",
|
||||
FLAG_IN_RANGE(1, 1000000));
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_bool(storage_snapshot_on_exit, false, "Controls whether the storage creates another snapshot on exit.");
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_bool(telemetry_enabled, false,
|
||||
"Set to true to enable telemetry. We collect information about the "
|
||||
"running system (CPU and memory information) and information about "
|
||||
@ -215,9 +234,12 @@ DEFINE_string(pulsar_service_url, "", "Default URL used while connecting to Puls
|
||||
|
||||
// Audit logging flags.
|
||||
#ifdef MG_ENTERPRISE
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_bool(audit_enabled, false, "Set to true to enable audit logging.");
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_VALIDATED_int32(audit_buffer_size, memgraph::audit::kBufferSizeDefault,
|
||||
"Maximum number of items in the audit log buffer.", FLAG_IN_RANGE(1, INT32_MAX));
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
DEFINE_VALIDATED_int32(audit_buffer_flush_interval_ms, memgraph::audit::kBufferFlushIntervalMillisDefault,
|
||||
"Interval (in milliseconds) used for flushing the audit log buffer.",
|
||||
FLAG_IN_RANGE(10, INT32_MAX));
|
||||
|
@ -92,7 +92,7 @@ void TrackMemory(std::size_t size) {
|
||||
size = nallocx(size, 0);
|
||||
}
|
||||
#endif
|
||||
memgraph::utils::total_memory_tracker.Alloc(size);
|
||||
memgraph::utils::total_memory_tracker.Alloc(static_cast<int64_t>(size));
|
||||
}
|
||||
|
||||
void TrackMemory(std::size_t size, const std::align_val_t align) {
|
||||
@ -101,7 +101,7 @@ void TrackMemory(std::size_t size, const std::align_val_t align) {
|
||||
size = nallocx(size, MALLOCX_ALIGN(align)); // NOLINT(hicpp-signed-bitwise)
|
||||
}
|
||||
#endif
|
||||
memgraph::utils::total_memory_tracker.Alloc(size);
|
||||
memgraph::utils::total_memory_tracker.Alloc(static_cast<int64_t>(size));
|
||||
}
|
||||
|
||||
bool TrackMemoryNoExcept(const std::size_t size) {
|
||||
@ -132,10 +132,10 @@ void UntrackMemory([[maybe_unused]] void *ptr, [[maybe_unused]] std::size_t size
|
||||
}
|
||||
#else
|
||||
if (size) {
|
||||
memgraph::utils::total_memory_tracker.Free(size);
|
||||
memgraph::utils::total_memory_tracker.Free(static_cast<int64_t>(size));
|
||||
} else {
|
||||
// Innaccurate because malloc_usable_size() result is greater or equal to allocated size.
|
||||
memgraph::utils::total_memory_tracker.Free(malloc_usable_size(ptr));
|
||||
memgraph::utils::total_memory_tracker.Free(static_cast<int64_t>(malloc_usable_size(ptr)));
|
||||
}
|
||||
#endif
|
||||
} catch (...) {
|
||||
@ -150,10 +150,10 @@ void UntrackMemory(void *ptr, const std::align_val_t align, [[maybe_unused]] std
|
||||
}
|
||||
#else
|
||||
if (size) {
|
||||
memgraph::utils::total_memory_tracker.Free(size);
|
||||
memgraph::utils::total_memory_tracker.Free(static_cast<int64_t>(size));
|
||||
} else {
|
||||
// Innaccurate because malloc_usable_size() result is greater or equal to allocated size.
|
||||
memgraph::utils::total_memory_tracker.Free(malloc_usable_size(ptr));
|
||||
memgraph::utils::total_memory_tracker.Free(static_cast<int64_t>(malloc_usable_size(ptr)));
|
||||
}
|
||||
#endif
|
||||
} catch (...) {
|
||||
|
@ -370,7 +370,7 @@ double StringToDouble(const std::string &value) {
|
||||
|
||||
/// @throw LoadException
|
||||
memgraph::storage::PropertyValue StringToValue(const std::string &str, const std::string &type) {
|
||||
if (FLAGS_ignore_empty_strings && str.empty()) return memgraph::storage::PropertyValue();
|
||||
if (FLAGS_ignore_empty_strings && str.empty()) return {};
|
||||
auto convert = [](const auto &str, const auto &type) {
|
||||
if (type == "integer" || type == "int" || type == "long" || type == "byte" || type == "short") {
|
||||
return memgraph::storage::PropertyValue(StringToInt(str));
|
||||
@ -416,8 +416,8 @@ std::string GetIdSpace(const std::string &type) {
|
||||
}
|
||||
|
||||
/// @throw LoadException
|
||||
void ProcessNodeRow(memgraph::storage::Storage *store, const std::vector<Field> &fields,
|
||||
const std::vector<std::string> &row, const std::vector<std::string> &additional_labels,
|
||||
void ProcessNodeRow(memgraph::storage::Storage *store, const std::vector<std::string> &row,
|
||||
const std::vector<Field> &fields, const std::vector<std::string> &additional_labels,
|
||||
std::unordered_map<NodeId, memgraph::storage::Gid> *node_id_map) {
|
||||
std::optional<NodeId> id;
|
||||
auto acc = store->Access();
|
||||
@ -500,7 +500,7 @@ void ProcessNodes(memgraph::storage::Storage *store, const std::string &nodes_pa
|
||||
if (row.size() > (*header)->size()) {
|
||||
row.resize((*header)->size());
|
||||
}
|
||||
ProcessNodeRow(store, **header, row, additional_labels, node_id_map);
|
||||
ProcessNodeRow(store, row, **header, additional_labels, node_id_map);
|
||||
row_number += lines_count;
|
||||
}
|
||||
} catch (const LoadException &e) {
|
||||
|
@ -3721,7 +3721,7 @@ void CallCustomProcedure(const std::string_view &fully_qualified_procedure_name,
|
||||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
auto arg = args[i]->Accept(*evaluator);
|
||||
std::string_view name;
|
||||
const memgraph::query::procedure::CypherType *type;
|
||||
const memgraph::query::procedure::CypherType *type{nullptr};
|
||||
if (proc.args.size() > i) {
|
||||
name = proc.args[i].first;
|
||||
type = proc.args[i].second;
|
||||
|
@ -223,7 +223,7 @@ bool PlanPrinter::PreVisit(memgraph::query::plan::LoadCsv &op) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PlanPrinter::Visit(memgraph::query::plan::Once &op) {
|
||||
bool PlanPrinter::Visit(memgraph::query::plan::Once & /*op*/) {
|
||||
WithPrintLn([](auto &out) { out << "* Once"; });
|
||||
return true;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ memgraph::query::TypedValue ToTypedValue(const mgp_value &val, memgraph::utils::
|
||||
case MGP_VALUE_TYPE_DOUBLE:
|
||||
return memgraph::query::TypedValue(val.double_v, memory);
|
||||
case MGP_VALUE_TYPE_STRING:
|
||||
return memgraph::query::TypedValue(val.string_v, memory);
|
||||
return {val.string_v, memory};
|
||||
case MGP_VALUE_TYPE_LIST: {
|
||||
const auto *list = val.list_v;
|
||||
memgraph::query::TypedValue::TVector tv_list(memory);
|
||||
|
@ -31,7 +31,7 @@ void Load(memgraph::storage::Gid *gid, memgraph::slk::Reader *reader) {
|
||||
|
||||
void Load(memgraph::storage::PropertyValue::Type *type, memgraph::slk::Reader *reader) {
|
||||
using PVTypeUnderlyingType = std::underlying_type_t<memgraph::storage::PropertyValue::Type>;
|
||||
PVTypeUnderlyingType value;
|
||||
PVTypeUnderlyingType value{};
|
||||
memgraph::slk::Load(&value, reader);
|
||||
bool valid;
|
||||
switch (value) {
|
||||
@ -105,7 +105,7 @@ void Save(const memgraph::storage::PropertyValue &value, memgraph::slk::Builder
|
||||
}
|
||||
|
||||
void Load(memgraph::storage::PropertyValue *value, memgraph::slk::Reader *reader) {
|
||||
memgraph::storage::PropertyValue::Type type;
|
||||
memgraph::storage::PropertyValue::Type type{};
|
||||
memgraph::slk::Load(&type, reader);
|
||||
switch (type) {
|
||||
case memgraph::storage::PropertyValue::Type::Null:
|
||||
@ -158,7 +158,7 @@ void Load(memgraph::storage::PropertyValue *value, memgraph::slk::Reader *reader
|
||||
return;
|
||||
}
|
||||
case memgraph::storage::PropertyValue::Type::TemporalData: {
|
||||
memgraph::storage::TemporalType temporal_type;
|
||||
memgraph::storage::TemporalType temporal_type{};
|
||||
memgraph::slk::Load(&temporal_type, reader);
|
||||
int64_t microseconds{0};
|
||||
memgraph::slk::Load(µseconds, reader);
|
||||
|
Loading…
Reference in New Issue
Block a user