зеркало из https://github.com/microsoft/CCF.git
Do not use seqnos from NoKV transactions in performance tests (#1286)
This commit is contained in:
Родитель
5ef2af4754
Коммит
d4ebc3aef3
|
@ -257,7 +257,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO_FMT("VERIFIED {}", prefix);
|
LOG_INFO_FMT("Verified {}", prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void verify_initial_state(const nlohmann::json& expected) override
|
void verify_initial_state(const nlohmann::json& expected) override
|
||||||
|
|
|
@ -425,19 +425,15 @@ namespace client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto global_commit_response = wait_for_global_commit(
|
|
||||||
trigger_signature(create_connection(true, false)));
|
|
||||||
size_t last_commit = 0;
|
|
||||||
if (!options.no_wait)
|
if (!options.no_wait)
|
||||||
{
|
{
|
||||||
const auto commit_ids =
|
// Create a new connection, because we need to do some GETs
|
||||||
timing::parse_commit_ids(global_commit_response);
|
// and when all you have is a WebSocket, everything looks like a POST!
|
||||||
last_commit = commit_ids.global;
|
auto c = create_connection(true, false);
|
||||||
}
|
trigger_signature(c);
|
||||||
else
|
wait_for_global_commit(last_response_commit);
|
||||||
{
|
|
||||||
last_commit = last_response_commit.seqno;
|
|
||||||
}
|
}
|
||||||
|
const auto last_commit = last_response_commit.seqno;
|
||||||
auto timing_results = end_timing(last_commit);
|
auto timing_results = end_timing(last_commit);
|
||||||
LOG_INFO_FMT("Timing ended");
|
LOG_INFO_FMT("Timing ended");
|
||||||
return timing_results;
|
return timing_results;
|
||||||
|
@ -524,23 +520,27 @@ namespace client
|
||||||
// Send a mkSign RPC to trigger next global commit
|
// Send a mkSign RPC to trigger next global commit
|
||||||
const auto method = "mkSign";
|
const auto method = "mkSign";
|
||||||
const auto mk_sign = connection->gen_request(method);
|
const auto mk_sign = connection->gen_request(method);
|
||||||
if (response_times.is_timing_active())
|
|
||||||
{
|
|
||||||
response_times.record_send(method, mk_sign.id, true);
|
|
||||||
}
|
|
||||||
connection->write(mk_sign.encoded);
|
connection->write(mk_sign.encoded);
|
||||||
|
|
||||||
// Do a blocking read for this final response
|
// Do a blocking read for this final response
|
||||||
const auto response = connection->read_response();
|
const auto response = connection->read_response();
|
||||||
process_reply(response);
|
process_reply(response);
|
||||||
|
LOG_INFO_FMT("Triggered signature");
|
||||||
const auto commit_ids = timing::parse_commit_ids(response);
|
|
||||||
LOG_INFO_FMT(
|
|
||||||
"Triggered signature at {}.{}", commit_ids.view, commit_ids.seqno);
|
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RpcTlsClient::Response get_tx_status(
|
||||||
|
const std::shared_ptr<RpcTlsClient>& connection,
|
||||||
|
size_t view,
|
||||||
|
size_t seqno)
|
||||||
|
{
|
||||||
|
nlohmann::json p;
|
||||||
|
p["seqno"] = seqno;
|
||||||
|
p["view"] = view;
|
||||||
|
return connection->get("tx", p);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void verify_params(const nlohmann::json& expected)
|
virtual void verify_params(const nlohmann::json& expected)
|
||||||
{
|
{
|
||||||
// It's only reasonable to compare against expected state if the initial
|
// It's only reasonable to compare against expected state if the initial
|
||||||
|
@ -649,11 +649,14 @@ namespace client
|
||||||
{
|
{
|
||||||
const auto last_response = send_creation_transactions();
|
const auto last_response = send_creation_transactions();
|
||||||
|
|
||||||
if (last_response.has_value())
|
if (
|
||||||
|
last_response.has_value() &&
|
||||||
|
http::status_success(last_response->status))
|
||||||
{
|
{
|
||||||
// Ensure creation transactions are globally committed before
|
// Ensure creation transactions are globally committed before
|
||||||
// proceeding
|
// proceeding
|
||||||
wait_for_global_commit(trigger_signature(create_connection(true)));
|
trigger_signature(create_connection(true));
|
||||||
|
wait_for_global_commit(last_response.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
|
@ -693,13 +696,13 @@ namespace client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RpcTlsClient::Response wait_for_global_commit(
|
timing::CommitPoint wait_for_global_commit(
|
||||||
const timing::CommitPoint& target)
|
const timing::CommitPoint& target)
|
||||||
{
|
{
|
||||||
return response_times.wait_for_global_commit(target);
|
return response_times.wait_for_global_commit(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
RpcTlsClient::Response wait_for_global_commit(
|
timing::CommitPoint wait_for_global_commit(
|
||||||
const RpcTlsClient::Response& response)
|
const RpcTlsClient::Response& response)
|
||||||
{
|
{
|
||||||
check_response(response);
|
check_response(response);
|
||||||
|
|
|
@ -29,12 +29,13 @@ class ScenarioPerfClient : public Base
|
||||||
private:
|
private:
|
||||||
nlohmann::json scenario_json;
|
nlohmann::json scenario_json;
|
||||||
|
|
||||||
RpcTlsClient::Response send_verbose_transactions(
|
std::optional<RpcTlsClient::Response> send_verbose_transactions(
|
||||||
const std::shared_ptr<RpcTlsClient>& connection, char const* element_name)
|
const std::shared_ptr<RpcTlsClient>& connection, char const* element_name)
|
||||||
{
|
{
|
||||||
const auto it = scenario_json.find(element_name);
|
const auto it = scenario_json.find(element_name);
|
||||||
|
|
||||||
RpcTlsClient::Response response;
|
RpcTlsClient::Response response;
|
||||||
|
bool sent = false;
|
||||||
|
|
||||||
if (it != scenario_json.end())
|
if (it != scenario_json.end())
|
||||||
{
|
{
|
||||||
|
@ -56,12 +57,16 @@ private:
|
||||||
|
|
||||||
LOG_INFO_FMT("Sending {}: {}", method, params.dump(2));
|
LOG_INFO_FMT("Sending {}: {}", method, params.dump(2));
|
||||||
response = connection->call(method, params);
|
response = connection->call(method, params);
|
||||||
|
sent = true;
|
||||||
const auto response_body = connection->unpack_body(response);
|
const auto response_body = connection->unpack_body(response);
|
||||||
LOG_INFO_FMT("Response: {} {}", response.status, response_body.dump(2));
|
LOG_INFO_FMT("Response: {} {}", response.status, response_body.dump(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
if (sent)
|
||||||
|
return response;
|
||||||
|
else
|
||||||
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pre_creation_hook() override
|
void pre_creation_hook() override
|
||||||
|
|
|
@ -248,7 +248,7 @@ namespace timing
|
||||||
// committed (or will never be committed), returns first confirming
|
// committed (or will never be committed), returns first confirming
|
||||||
// response. Calls record_[send/response], if record is true.
|
// response. Calls record_[send/response], if record is true.
|
||||||
// Throws on errors, or if target is rolled back
|
// Throws on errors, or if target is rolled back
|
||||||
RpcTlsClient::Response wait_for_global_commit(
|
CommitPoint wait_for_global_commit(
|
||||||
const CommitPoint& target, bool record = true)
|
const CommitPoint& target, bool record = true)
|
||||||
{
|
{
|
||||||
auto params = nlohmann::json::object();
|
auto params = nlohmann::json::object();
|
||||||
|
@ -302,7 +302,7 @@ namespace timing
|
||||||
commit_ids.view,
|
commit_ids.view,
|
||||||
commit_ids.seqno,
|
commit_ids.seqno,
|
||||||
commit_ids.global);
|
commit_ids.global);
|
||||||
return response;
|
return {commit_ids.view, commit_ids.seqno};
|
||||||
}
|
}
|
||||||
else if (tx_status == "INVALID")
|
else if (tx_status == "INVALID")
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче