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 

return;
    }
    auto metadata_snapshot = getInMemoryMetadataPtr();
    
    
    if (attach && !current_zookeeper->exists(replica_path))
    {
        LOG_WARNING(log, "No metadata in ZooKeeper for {}: table will be in readonly mode", replica_path);
        is_readonly = true;
        has_metadata_in_zookeeper = false;
        return;
    }
    if (!attach)
    {
        if (!getDataParts().empty())
            throw Exception("Data directory for table already contains data parts"
                " - probably it was unclean DROP table or manual intervention."
                " You must either clear directory by hand or use ATTACH TABLE"
                " instead of CREATE TABLE if you need to use that parts.", ErrorCodes::INCORRECT_DATA);
        try
        {
            bool is_first_replica = createTableIfNotExists(metadata_snapshot);
            try
            {
                
                
                
                
                other_replicas_fixed_granularity = checkFixedGranularityInZookeeper();
                checkTableStructure(zookeeper_path, metadata_snapshot);