private void maybeSetMetadataError(Cluster cluster) {
        clearRecoverableErrors();
        checkInvalidTopics(cluster);
        checkUnauthorizedTopics(cluster);
    }
Updates the partition-leadership info in the metadata. Update is done by merging existing metadata with the input leader information and nodes.
This is called whenever partition-leadership updates are returned in a response from broker(ex - ProduceResponse & FetchResponse).
Note that the updates via Metadata RPC are handled separately in ({@link #update}).
Both partitionLeader and leaderNodes override the existing metadata. Non-overlapping metadata is kept as it is.
@param partitionLeaders map of new leadership information for partitions.
@param leaderNodes a list of nodes for leaders in the above map.
@return a set of partitions, for which leaders were updated.
clients/src/main/java/org/apache/kafka/clients/Metadata.java