in src/hbase/client/location-cache.cc [121:146]
ServerName LocationCache::ReadMetaLocation() {
auto buf = folly::IOBuf::create(4096);
ZkDeserializer derser;
EnsureZooKeeperConnection();
// This needs to be int rather than size_t as that's what ZK expects.
int len = buf->capacity();
std::string zk_node = ZKUtil::MetaZNode(*conf_);
int zk_result = zoo_get(this->zk_, zk_node.c_str(), 0,
reinterpret_cast<char *>(buf->writableData()), &len, nullptr);
if (zk_result != ZOK || len < 9) {
LOG(ERROR) << "Error getting meta location.";
// We just close the zk connection, and let the upper levels retry.
CloseZooKeeperConnection();
throw std::runtime_error("Error getting meta location. Quorum: " + zk_quorum_);
}
buf->append(len);
MetaRegionServer mrs;
if (derser.Parse(buf.get(), &mrs) == false) {
LOG(ERROR) << "Unable to decode";
throw std::runtime_error("Error getting meta location (Unable to decode). Quorum: " +
zk_quorum_);
}
return mrs.server();
}