| 1494 | } |
| 1495 | |
| 1496 | void removeRecursive(Coordination::ZooKeeper & zookeeper, const std::string & path, bool allow_native) |
| 1497 | { |
| 1498 | if (allow_native && zookeeper.isFeatureEnabled(DB::KeeperFeatureFlag::REMOVE_RECURSIVE)) |
| 1499 | { |
| 1500 | auto promise = std::make_shared<std::promise<Coordination::Error>>(); |
| 1501 | auto future = promise->get_future(); |
| 1502 | zookeeper.removeRecursive(path, /*remove_nodes_limit=*/ 100000000, |
| 1503 | [promise](const Coordination::RemoveRecursiveResponse & response) |
| 1504 | { |
| 1505 | promise->set_value(response.error); |
| 1506 | }); |
| 1507 | auto error = future.get(); |
| 1508 | if (error == Coordination::Error::ZNONODE) |
| 1509 | return; |
| 1510 | if (error != Coordination::Error::ZOK) |
| 1511 | throw zkutil::KeeperException(error, "Failed to recursively remove {}", path); |
| 1512 | return; |
| 1513 | } |
| 1514 | |
| 1515 | Coordination::Requests batch; |
| 1516 | removeRecursiveManual(zookeeper, path, batch); |
| 1517 | flushMulti(zookeeper, batch); |
| 1518 | } |
| 1519 | |
| 1520 | } |
| 1521 |
no test coverage detected