| 720 | } |
| 721 | |
| 722 | void ExecEnv::UpdateActiveCatalogd(bool is_registration_reply, |
| 723 | int64 active_catalogd_version, const TCatalogRegistration& catalogd_registration) { |
| 724 | std::lock_guard<std::mutex> l(catalogd_address_lock_); |
| 725 | if (!active_catalogd_version_checker_->CheckActiveCatalogdVersion( |
| 726 | is_registration_reply, active_catalogd_version)) { |
| 727 | return; |
| 728 | } |
| 729 | if (catalogd_registration.address.hostname.empty() |
| 730 | || catalogd_registration.address.port == 0) { |
| 731 | return; |
| 732 | } |
| 733 | if (catalogd_registration.protocol |
| 734 | != statestore_subscriber_->GetCatalogProtocolVersion()) { |
| 735 | // This should not happen now. Since we bump up catalog and statestore service |
| 736 | // versions at same time, coordinators must have same protocol versions as catalogd |
| 737 | // if they can join one cluster. But in future, it may happen if the two protocol |
| 738 | // versions are not updated at same time for some reason. |
| 739 | // Note that Impalad coordinators must wait for their local replica of the catalog to |
| 740 | // be initialized from the statestore prior to opening up client ports. If the |
| 741 | // coordinator has incompatible protocol version from catalogd, it should not open |
| 742 | // client ports. |
| 743 | LOG(INFO) << "Protocol version of Catalog service does not match the protocol " |
| 744 | << "version of registered catalogd: " |
| 745 | << statestore_subscriber_->GetCatalogProtocolVersion() |
| 746 | << " vs. " << catalogd_registration.protocol; |
| 747 | } |
| 748 | DCHECK(catalogd_address_.get() != nullptr); |
| 749 | if (!is_catalogd_address_metric_set_) { |
| 750 | // At least set the metric once. |
| 751 | is_catalogd_address_metric_set_ = true; |
| 752 | ImpaladMetrics::ACTIVE_CATALOGD_ADDRESS->SetValue( |
| 753 | TNetworkAddressToString(catalogd_registration.address)); |
| 754 | } |
| 755 | bool is_matching = (catalogd_registration.address.port == catalogd_address_->port |
| 756 | && catalogd_registration.address.hostname == catalogd_address_->hostname); |
| 757 | if (!is_matching) { |
| 758 | RETURN_VOID_IF_ERROR( |
| 759 | DebugAction(FLAGS_debug_actions, "IGNORE_NEW_ACTIVE_CATALOGD_ADDR")); |
| 760 | LOG(INFO) << "The address of Catalog service is changed from " |
| 761 | << TNetworkAddressToString(*catalogd_address_.get()) |
| 762 | << " to " << TNetworkAddressToString(catalogd_registration.address); |
| 763 | catalogd_address_ = |
| 764 | std::make_shared<const TNetworkAddress>(catalogd_registration.address); |
| 765 | ImpaladMetrics::ACTIVE_CATALOGD_ADDRESS->SetValue( |
| 766 | TNetworkAddressToString(catalogd_registration.address)); |
| 767 | } |
| 768 | } |
| 769 | |
| 770 | std::shared_ptr<const TNetworkAddress> ExecEnv::GetCatalogdAddress() const { |
| 771 | std::lock_guard<std::mutex> l(catalogd_address_lock_); |
nothing calls this directly
no test coverage detected