It hurts if server has millions of tables.

See https://github.com/ClickHouse/ClickHouse/pull/3398
Please add some tests to ensure it won't be broken in future.
fs::path path(getMetadataPath());
        fs::path file_path(file_name);
        fs::path full_path = path / file_path;
        try
        {
            auto ast = parseQueryFromMetadata(log, context, full_path.string(),  true,  false);
            if (ast)
            {
                auto * create_query = ast->as<ASTCreateQuery>();
                file_names[file_name] = ast;
                total_dictionaries += create_query->is_dictionary;
            }
        }
        catch (Exception & e)
        {
            e.addMessage("Cannot parse definition from metadata file " + full_path.string());
            throw;
        }
    };
    iterateMetadataFiles(context, process_metadata);
    size_t total_tables = file_names.size() - total_dictionaries;
    LOG_INFO(log, "Total {} tables and {} dictionaries.", total_tables, total_dictionaries);
    AtomicStopwatch watch;
    std::atomic<size_t> tables_processed{0};
    std::atomic<size_t> dictionaries_processed{0};
    ThreadPool pool(SettingMaxThreads().getAutoValue());
    
    for (const auto & name_with_query : file_names)
    {
        const auto & create_query = name_with_query.second->as<const ASTCreateQuery &>();