I am reading clickhouse mutation code. In StorageMergeTree->selectPartsToMutate() function, there is a check 
`if (current_ast_elements + commands_size >= max_ast_elements)
                break;`

I think if there are many mutations then the check result will be true, so that it will skip the remaining mutations.
But the new part's mutation is set to the last one in mutation map, and it does not apply the remaining mutations actually.
`new_part_info.mutation = current_mutations_by_version.rbegin()->first;`

Then the new part will miss the remaining mutations in future mutation job.

I think it's wrong here. Am I right?

If it is right, I will submit a PR 

const IMergeTreeDataPart & part, DiskType disk_type) const
{
    String best_replica;
    zkutil::ZooKeeperPtr zookeeper = tryGetZooKeeper();
    if (!zookeeper)
        return best_replica;
    String zero_copy = fmt::format("zero_copy_{}", toString(disk_type));
    String zookeeper_part_node = fs::path(zookeeper_path) / zero_copy / "shared" / part.name;
    Strings ids;
    zookeeper->tryGetChildren(zookeeper_part_node, ids);
    Strings replicas;
    for (const auto & id : ids)
    {
        String zookeeper_part_uniq_node = fs::path(zookeeper_part_node) / id;
        Strings id_replicas;
        zookeeper->tryGetChildren(zookeeper_part_uniq_node, id_replicas);
        LOG_TRACE(log, "Found zookeper replicas for {}: {}", zookeeper_part_uniq_node, id_replicas.size());
        replicas.insert(replicas.end(), id_replicas.begin(), id_replicas.end());
    }
    LOG_TRACE(log, "Found zookeper replicas for part {}: {}", part.name, replicas.size());
    Strings active_replicas;
    
    
    active_replicas.reserve(replicas.size());
    for (const String & replica : replicas)
        if ((replica != replica_name) && (zookeeper->exists(fs::path(zookeeper_path) / "replicas" / replica / "is_active")))
            active_replicas.push_back(replica);