Fixed segfault in an integration test. [#CLICKHOUSE-2]

This commit is contained in:
Vitaliy Lyudvichenko 2018-02-27 19:52:00 +03:00
parent 0e7c49fe9b
commit f89d9dbfb9
3 changed files with 7 additions and 6 deletions

View File

@ -641,7 +641,8 @@ int32_t ZooKeeper::tryMulti(const Ops & ops_, OpResultsPtr * out_results_)
int32_t ZooKeeper::tryMultiUnsafe(const Ops & ops, MultiTransactionInfo & info)
{
info.code = multiImpl(ops, &info.op_results);
info.ops = &ops;
for (const OpPtr & op : ops)
info.ops.emplace_back(op->clone());
return info.code;
}

View File

@ -499,13 +499,13 @@ struct MultiTransactionInfo
{
MultiTransactionInfo() = default;
const Ops * ops = nullptr;
Ops ops;
int32_t code = ZOK;
OpResultsPtr op_results;
bool empty() const
{
return ops == nullptr;
return ops.empty();
}
bool hasFailedOp() const
@ -515,7 +515,7 @@ struct MultiTransactionInfo
const Op & getFailedOp() const
{
return *ops->at(getFailedOpIndex(op_results, code));
return *ops.at(getFailedOpIndex(op_results, code));
}
KeeperException getException() const
@ -523,7 +523,7 @@ struct MultiTransactionInfo
if (hasFailedOp())
{
size_t i = getFailedOpIndex(op_results, code);
return KeeperException("Transaction failed at op #" + std::to_string(i) + ": " + ops->at(i)->describe(), code);
return KeeperException("Transaction failed at op #" + std::to_string(i) + ": " + ops.at(i)->describe(), code);
}
else
return KeeperException(code);

View File

@ -196,7 +196,7 @@ def test_copy_month_to_week_partition(started_cluster):
execute_task(Task2(started_cluster), [])
def test_copy_month_to_week_partition_with_recovering(started_cluster):
execute_task(Task2(started_cluster), ['--copy-fault-probability', str(0.1)])
execute_task(Task2(started_cluster), ['--copy-fault-probability', str(0.3)])
if __name__ == '__main__':