Merge branch 'project-pineapples' into T1079-MG-add-simple-query-to-benchmark_v2

This commit is contained in:
Jeremy B 2022-10-17 11:41:55 +02:00 committed by GitHub
commit f063c1b1ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -73,8 +73,7 @@ bool SimulatorHandle::MaybeTickSimulator() {
// We tick the clock forward when all servers are blocked but
// there are no in-flight messages to schedule delivery of.
std::poisson_distribution<> time_distrib(50);
Duration clock_advance = std::chrono::microseconds{time_distrib(rng_)};
const Duration clock_advance = std::chrono::microseconds{time_distrib_(rng_)};
cluster_wide_time_microseconds_ += clock_advance;
MG_ASSERT(cluster_wide_time_microseconds_ < config_.abort_time,
@ -93,8 +92,7 @@ bool SimulatorHandle::MaybeTickSimulator() {
auto [to_address, opaque_message] = std::move(in_flight_.back());
in_flight_.pop_back();
std::uniform_int_distribution<int> drop_distrib(0, 99);
const int drop_threshold = drop_distrib(rng_);
const int drop_threshold = drop_distrib_(rng_);
const bool should_drop = drop_threshold < config_.drop_percent;
if (should_drop) {

View File

@ -51,6 +51,8 @@ class SimulatorHandle {
std::set<Address> blocked_on_receive_;
std::set<Address> server_addresses_;
std::mt19937 rng_;
std::uniform_int_distribution<int> time_distrib_{5, 50};
std::uniform_int_distribution<int> drop_distrib_{0, 99};
SimulatorConfig config_;
void TimeoutPromisesPastDeadline() {

View File

@ -690,7 +690,7 @@ int main(int argc, char **argv) {
std::optional<memgraph::telemetry::Telemetry> telemetry;
// Handler for regular termination signals
auto shutdown = [&server, &interpreter_context] {
auto shutdown = [&server, &interpreter_context, &ls] {
// Server needs to be shutdown first and then the database. This prevents
// a race condition when a transaction is accepted during server shutdown.
server.Shutdown();
@ -698,6 +698,7 @@ int main(int argc, char **argv) {
// connections we tell the execution engine to stop processing all pending
// queries.
memgraph::query::v2::Shutdown(&interpreter_context);
ls.ShutDown();
};
InitSignalHandlers(shutdown);