Beispiel #1
0
int main(int argc_, char ** argv_)
{
#if USE_EMBEDDED_COMPILER
    if (argc_ >= 2 && 0 == strcmp(argv_[1], "-cc1"))
        return mainEntryClickHouseClang(argc_, argv_);
#endif

#if USE_TCMALLOC
    /** Without this option, tcmalloc returns memory to OS too frequently for medium-sized memory allocations
      *  (like IO buffers, column vectors, hash tables, etc.),
      *  that lead to page faults and significantly hurts performance.
      */
    MallocExtension::instance()->SetNumericProperty("tcmalloc.aggressive_memory_decommit", false);
#endif

    std::vector<char *> argv(argv_, argv_ + argc_);

    /// Print a basic help if nothing was matched
    MainFunc main_func = printHelp;

    for (auto & application : clickhouse_applications)
    {
        if (isClickhouseApp(application.first, argv))
        {
            main_func = application.second;
            break;
        }
    }

    return main_func(static_cast<int>(argv.size()), argv.data());
}
Beispiel #2
0
int main(int argc_, char ** argv_)
{
#if USE_TCMALLOC
    MallocExtension::instance()->SetNumericProperty("tcmalloc.aggressive_memory_decommit", false);
#endif

    std::vector<char *> argv(argv_, argv_ + argc_);

    auto main_func = mainEntryClickHouseServer;

    if (isClickhouseApp("local", argv))
        main_func = mainEntryClickHouseLocal;
    else if (isClickhouseApp("client", argv))
        main_func = mainEntryClickHouseClient;
    else if (isClickhouseApp("benchmark", argv))
        main_func = mainEntryClickHouseBenchmark;
    else if (isClickhouseApp("server", argv)) /// --server arg should be cut
        main_func = mainEntryClickHouseServer;
    else if (isClickhouseApp("performance-test", argv))
        main_func = mainEntryClickhousePerformanceTest;
    else if (isClickhouseApp("extract-from-config", argv))
        main_func = mainEntryClickHouseExtractFromConfig;

    return main_func(static_cast<int>(argv.size()), argv.data());
}