Merge pull request #21842 from HumanUser/master

zookeeper-dump-tree: added ctime option to dump node ctime
This commit is contained in:
alexey-milovidov 2021-03-18 01:06:43 +03:00 committed by GitHub
commit b8a437c35a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ int main(int argc, char ** argv)
"addresses of ZooKeeper instances, comma separated. Example: example01e.yandex.ru:2181")
("path,p", boost::program_options::value<std::string>()->default_value("/"),
"where to start")
("ctime,c", "print node ctime")
;
boost::program_options::variables_map options;
@ -30,6 +31,8 @@ int main(int argc, char ** argv)
return 1;
}
bool dump_ctime = options.count("ctime");
zkutil::ZooKeeperPtr zookeeper = std::make_shared<zkutil::ZooKeeper>(options.at("address").as<std::string>());
std::string initial_path = options.at("path").as<std::string>();
@ -79,7 +82,10 @@ int main(int argc, char ** argv)
throw;
}
std::cout << it->first << '\t' << response.stat.numChildren << '\t' << response.stat.dataLength << '\n';
std::cout << it->first << '\t' << response.stat.numChildren << '\t' << response.stat.dataLength;
if (dump_ctime)
std::cout << '\t' << response.stat.ctime;
std::cout << '\n';
for (const auto & name : response.names)
{