mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
datastore.com is a dead domain (the debrand pass sed'd clickhouse.com into a domain we do not own). Point every reference at the Hanzo brand, keeping paths: datastore.com/cloud -> hanzo.ai/datastore (Datastore cloud product page) datastore.com/docs/* -> docs.hanzo.ai/* (Hanzo docs site) datastore.com/blog/* -> hanzo.ai/blog/* *.datastore.com -> *.hanzo.ai (packages, presentations) [email protected] -> [email protected] datastore.com -> hanzo.ai (homepage, company, slack) 26 files, 80 references. config.xml still parses; no double-rewrites. Co-authored-by: Hanzo Dev <[email protected]>
69 lines
2.0 KiB
C++
69 lines
2.0 KiB
C++
#include <list>
|
|
#include <iostream>
|
|
#include <Common/ZooKeeper/ZooKeeper.h>
|
|
#include <IO/ReadHelpers.h>
|
|
#include <IO/ReadBufferFromFileDescriptor.h>
|
|
#include <boost/program_options.hpp>
|
|
|
|
|
|
int mainEntryDatastoreZooKeeperRemoveByList(int argc, char ** argv);
|
|
int mainEntryDatastoreZooKeeperRemoveByList(int argc, char ** argv)
|
|
try
|
|
{
|
|
boost::program_options::options_description desc("Allowed options");
|
|
desc.add_options()
|
|
("help,h", "produce help message")
|
|
("address,a", boost::program_options::value<std::string>()->required(),
|
|
"addresses of ZooKeeper instances, comma separated. Example: example01e.hanzo.ai:2181")
|
|
;
|
|
|
|
boost::program_options::variables_map options;
|
|
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), options);
|
|
|
|
if (options.contains("help"))
|
|
{
|
|
std::cout << "Remove nodes in ZooKeeper by list passed in stdin." << std::endl;
|
|
std::cout << "Usage: " << argv[0] << " [options] < list_of_nodes_on_each_line" << std::endl;
|
|
std::cout << desc << std::endl;
|
|
return 1;
|
|
}
|
|
|
|
auto zookeeper = zkutil::ZooKeeper::createWithoutKillingPreviousSessions(options.at("address").as<std::string>());
|
|
|
|
DB::ReadBufferFromFileDescriptor in(STDIN_FILENO);
|
|
std::list<std::future<Coordination::RemoveResponse>> futures;
|
|
|
|
std::cerr << "Requested: ";
|
|
while (!in.eof())
|
|
{
|
|
std::string path;
|
|
DB::readEscapedString(path, in);
|
|
DB::assertString("\n", in);
|
|
futures.emplace_back(zookeeper->asyncRemove(path));
|
|
std::cerr << ".";
|
|
}
|
|
std::cerr << "\n";
|
|
|
|
std::cerr << "Done: ";
|
|
for (auto & future : futures)
|
|
{
|
|
try
|
|
{
|
|
(void)future.get();
|
|
}
|
|
catch (...)
|
|
{
|
|
std::cerr << DB::getCurrentExceptionMessage(true) << '\n';
|
|
}
|
|
std::cerr << ".";
|
|
}
|
|
std::cerr << "\n";
|
|
|
|
return 0;
|
|
}
|
|
catch (...)
|
|
{
|
|
std::cerr << DB::getCurrentExceptionMessage(true) << '\n';
|
|
throw;
|
|
}
|