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

View File

@ -544,12 +544,14 @@ void ZooKeeperMultiResponse::readImpl(ReadBuffer & in)
void ZooKeeperMultiResponse::writeImpl(WriteBuffer & out) const
{
std::cerr << "WRITING MULTIRESPONSE " << responses.size() << std::endl;
for (auto & response : responses)
{
const ZooKeeperResponse & zk_response = dynamic_cast<const ZooKeeperResponse &>(*response);
OpNum op_num = zk_response.getOpNum();
bool done = false;
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(done, out);

View File

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