Some fixes

This commit is contained in:
alesapin 2020-11-09 20:50:39 +03:00
parent 456b0b94c1
commit 45b0894252
3 changed files with 10 additions and 4 deletions

View File

@ -376,12 +376,14 @@ struct TestKeeperStorageMultiRequest final : public TestKeeperStorageRequest
try try
{ {
size_t i = 0;
for (const auto & concrete_request : concrete_requests) for (const auto & concrete_request : concrete_requests)
{ {
auto [ cur_response, undo_action ] = concrete_request->process(container, zxid); auto [ cur_response, undo_action ] = concrete_request->process(container, zxid);
response.responses.emplace_back(cur_response); response.responses[i] = cur_response;
if (cur_response->error != Coordination::Error::ZOK) if (cur_response->error != Coordination::Error::ZOK)
{ {
std::cerr << "GOT ERROR ON: " << i << " error" << static_cast<int32_t>(cur_response->error) << std::endl;
response.error = cur_response->error; response.error = cur_response->error;
for (auto it = undo_actions.rbegin(); it != undo_actions.rend(); ++it) for (auto it = undo_actions.rbegin(); it != undo_actions.rend(); ++it)
@ -392,6 +394,7 @@ struct TestKeeperStorageMultiRequest final : public TestKeeperStorageRequest
} }
else else
undo_actions.emplace_back(std::move(undo_action)); undo_actions.emplace_back(std::move(undo_action));
++i;
} }
response.error = Coordination::Error::ZOK; response.error = Coordination::Error::ZOK;
@ -482,9 +485,6 @@ void TestKeeperStorage::finalize()
} }
class TestKeeperWrapperFactory final : private boost::noncopyable class TestKeeperWrapperFactory final : private boost::noncopyable
{ {

View File

@ -544,12 +544,14 @@ void ZooKeeperMultiResponse::readImpl(ReadBuffer & in)
void ZooKeeperMultiResponse::writeImpl(WriteBuffer & out) const void ZooKeeperMultiResponse::writeImpl(WriteBuffer & out) const
{ {
std::cerr << "WRITING MULTIRESPONSE " << responses.size() << std::endl;
for (auto & response : responses) for (auto & response : responses)
{ {
const ZooKeeperResponse & zk_response = dynamic_cast<const ZooKeeperResponse &>(*response); const ZooKeeperResponse & zk_response = dynamic_cast<const ZooKeeperResponse &>(*response);
OpNum op_num = zk_response.getOpNum(); OpNum op_num = zk_response.getOpNum();
bool done = false; bool done = false;
Error op_error = zk_response.error; Error op_error = zk_response.error;
std::cerr << "WRITING OP ERROR:" << static_cast<int32_t>(op_error) << std::endl;
Coordination::write(op_num, out); Coordination::write(op_num, out);
Coordination::write(done, out); Coordination::write(done, out);

View File

@ -824,11 +824,15 @@ void ZooKeeper::receiveEvent()
try try
{ {
std::cerr << "READING RESPONSE FOR REQUEST ID:" << request_info.request->getOpNum() << std::endl;
if (!response) if (!response)
response = request_info.request->makeResponse(); response = request_info.request->makeResponse();
if (err != Error::ZOK) if (err != Error::ZOK)
{
std::cerr << "GOT ERROR:" << static_cast<int32_t>(err) << std::endl;
response->error = err; response->error = err;
}
else else
{ {
response->readImpl(*in); response->readImpl(*in);