From 9235515dabb00f79e3d8ab31d1460d1b60479649 Mon Sep 17 00:00:00 2001 From: Tyler Neely Date: Thu, 3 Nov 2022 12:38:12 +0000 Subject: [PATCH] Reduce high_density_shard_create_scan shard+thread combinations. Log Raft write request demangled names --- src/io/rsm/raft.hpp | 16 +++++++++++++++- tests/unit/high_density_shard_create_scan.cpp | 5 ++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/io/rsm/raft.hpp b/src/io/rsm/raft.hpp index 8d825f9e9..a1814b77a 100644 --- a/src/io/rsm/raft.hpp +++ b/src/io/rsm/raft.hpp @@ -22,6 +22,8 @@ #include #include +#include + #include "io/message_conversion.hpp" #include "io/simulator/simulator.hpp" #include "io/transport.hpp" @@ -109,6 +111,16 @@ utils::TypeInfoRef TypeInfoFor(const WriteResponse & /* write_respo return typeid(WriteReturn); } +template +utils::TypeInfoRef TypeInfoFor(const WriteRequest & /* write_request */) { + return typeid(WriteOperation); +} + +template +utils::TypeInfoRef TypeInfoFor(const WriteRequest> &write_request) { + return TypeInfoForVariant(write_request.operation); +} + /// AppendRequest is a raft-level message that the Leader /// periodically broadcasts to all Follower peers. This /// serves three main roles: @@ -918,7 +930,9 @@ class Raft { // only leaders actually handle replication requests from clients std::optional Handle(Leader &leader, WriteRequest &&req, RequestId request_id, Address from_address) { - Log("handling WriteRequest"); + auto type_info = TypeInfoFor(req); + std::string demangled_name = boost::core::demangle(type_info.get().name()); + Log("handling WriteRequest<" + demangled_name + ">"); // we are the leader. add item to log and send Append to peers MG_ASSERT(state_.term >= LastLogTerm()); diff --git a/tests/unit/high_density_shard_create_scan.cpp b/tests/unit/high_density_shard_create_scan.cpp index 69c97ca19..6d0c23065 100644 --- a/tests/unit/high_density_shard_create_scan.cpp +++ b/tests/unit/high_density_shard_create_scan.cpp @@ -283,9 +283,8 @@ void RunWorkload(int shards, int replication_factor, int create_ops, int scan_op } TEST(MachineManager, ManyShards) { - auto shards_attempts = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 22, 24, 26, 28, 30, 32}; - auto shard_worker_thread_attempts = {1, 2, 3, 4, 6, 8}; + auto shards_attempts = {1, 2, 4, 8}; + auto shard_worker_thread_attempts = {1, 2, 4, 8}; auto replication_factor = 1; auto create_ops = 1024; auto scan_ops = 1;