MCPcopy Create free account
hub / github.com/ByConity/ByConity / initHDFS

Method initHDFS

programs/part-toolkit/PartMergerApp.cpp:48–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 "</yandex>";
47
48void PartMergerApp::initHDFS(DB::ContextMutablePtr context, Poco::Logger * log)
49{
50 LOG_DEBUG(log, "Initialize HDFS driver.");
51 using HDFSConnectionParams = DB::HDFSConnectionParams;
52
53 /// Init HDFS3 client config path.
54 DB::String hdfs_config = config().getString("hdfs3_config", "");
55 if (!hdfs_config.empty())
56 {
57 setenv("LIBHDFS3_CONF", hdfs_config.c_str(), 1);
58 }
59
60 /// Options load from command line argument use priority -100 in layeredconfiguration, so construct
61 /// hdfs params from config directly rather than from config file.
62 HDFSConnectionParams hdfs_params = HDFSConnectionParams(
63 HDFSConnectionParams::CONN_NNPROXY, config().getString("hdfs_user", "clickhouse"), config().getString("hdfs_nnproxy", "nnproxy"));
64 /// Yield params to the context so that we could get this later.
65 context->setHdfsConnectionParams(hdfs_params);
66
67 const int hdfs_max_fd_num = config().getInt("hdfs_max_fd_num", 100000);
68 const int hdfs_skip_fd_num = config().getInt("hdfs_skip_fd_num", 100);
69 const int hdfs_io_error_num_to_reconnect = config().getInt("hdfs_io_error_num_to_reconnect", 10);
70 registerDefaultHdfsFileSystem(hdfs_params, hdfs_max_fd_num, hdfs_skip_fd_num, hdfs_io_error_num_to_reconnect);
71}
72
73int PartMergerApp::main([[maybe_unused]] const std::vector<DB::String> & args)
74{

Callers

nothing calls this directly

Calls 7

configFunction · 0.50
getStringMethod · 0.45
emptyMethod · 0.45
getIntMethod · 0.45

Tested by

no test coverage detected