提交 15a6ac31 编写于 作者: A Alexey Milovidov

dbms: quorum inserts: development [#METR-16779].

上级 d53f1734
......@@ -44,23 +44,9 @@ public:
auto live_replicas = zookeeper->getChildren(storage.zookeeper_path + "/leader_election");
if (live_replicas.size() < quorum)
{
String list_of_replicas;
if (live_replicas.empty())
list_of_replicas = "none";
else
{
WriteBufferFromString out(list_of_replicas);
for (auto it = live_replicas.begin(); it != live_replicas.end(); ++it)
out << (it == live_replicas.begin() ? "" : ", ") << *it;
}
throw Exception("Number of alive replicas ("
+ toString(live_replicas.size()) + ") is less than requested quorum ("
+ toString(quorum) + "). Alive replicas: " + list_of_replicas,
+ toString(live_replicas.size()) + ") is less than requested quorum (" + toString(quorum) + ").",
ErrorCodes::TOO_LESS_LIVE_REPLICAS);
}
/** Достигнут ли кворум для последнего куска, для которого нужен кворум?
* Запись всех кусков с включенным кворумом линейно упорядочена.
......
......@@ -1969,7 +1969,11 @@ static void updateQuorum(
/// Кворум достигнут. Удаляем узел.
auto code = zookeeper->tryRemove(quorum_status_path, stat.version);
if (code == ZNONODE)
if (code == ZOK)
{
break;
}
else if (code == ZNONODE)
{
/// Кворум уже был достигнут.
break;
......@@ -1987,7 +1991,11 @@ static void updateQuorum(
/// Обновляем узел, прописывая туда на одну реплику больше.
auto code = zookeeper->trySet(quorum_status_path, quorum_entry.toString(), stat.version);
if (code == ZNONODE)
if (code == ZOK)
{
break;
}
else if (code == ZNONODE)
{
/// Кворум уже был достигнут.
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册