mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 01:12:12 +00:00
Moved some of utils to programs
This commit is contained in:
parent
d9fad57bde
commit
dc7bc42223
@ -89,7 +89,6 @@ string (TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
|
||||
list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
|
||||
option (ENABLE_FUZZING "Fuzzy testing using libfuzzer" OFF)
|
||||
option (ENABLE_FUZZER_TEST "Build testing fuzzers in order to test libFuzzer functionality" OFF)
|
||||
|
||||
if (ENABLE_FUZZING)
|
||||
# Also set WITH_COVERAGE=1 for better fuzzing process
|
||||
|
@ -119,20 +119,26 @@ macro(clickhouse_program_add name)
|
||||
clickhouse_program_add_library(${name})
|
||||
endmacro()
|
||||
|
||||
add_subdirectory (server)
|
||||
add_subdirectory (client)
|
||||
add_subdirectory (local)
|
||||
add_subdirectory (benchmark)
|
||||
add_subdirectory (extract-from-config)
|
||||
add_subdirectory (compressor)
|
||||
add_subdirectory (format)
|
||||
add_subdirectory (obfuscator)
|
||||
add_subdirectory (install)
|
||||
add_subdirectory (git-import)
|
||||
add_subdirectory (bash-completion)
|
||||
add_subdirectory (benchmark)
|
||||
add_subdirectory (check-marks)
|
||||
add_subdirectory (checksum-for-compressed-block)
|
||||
add_subdirectory (client)
|
||||
add_subdirectory (compressor)
|
||||
add_subdirectory (disks)
|
||||
add_subdirectory (extract-from-config)
|
||||
add_subdirectory (format)
|
||||
add_subdirectory (git-import)
|
||||
add_subdirectory (install)
|
||||
add_subdirectory (keeper-bench)
|
||||
add_subdirectory (keeper-data-dumper)
|
||||
add_subdirectory (local)
|
||||
add_subdirectory (obfuscator)
|
||||
add_subdirectory (server)
|
||||
add_subdirectory (static-files-disk-uploader)
|
||||
add_subdirectory (su)
|
||||
add_subdirectory (disks)
|
||||
add_subdirectory (zookeeper-dump-tree)
|
||||
add_subdirectory (zookeeper-remove-by-list)
|
||||
|
||||
if (ENABLE_CLICKHOUSE_KEEPER_CONVERTER)
|
||||
add_subdirectory (keeper-converter)
|
||||
@ -198,18 +204,24 @@ if (ENABLE_CLICKHOUSE_SELF_EXTRACTING)
|
||||
list(APPEND CLICKHOUSE_BUNDLE self-extracting)
|
||||
endif ()
|
||||
|
||||
clickhouse_program_install(clickhouse-server server)
|
||||
clickhouse_program_install(clickhouse-client client chc)
|
||||
clickhouse_program_install(clickhouse-local local chl ch)
|
||||
clickhouse_program_install(clickhouse-benchmark benchmark)
|
||||
clickhouse_program_install(clickhouse-extract-from-config extract-from-config)
|
||||
clickhouse_program_install(clickhouse-check-marks check-marks)
|
||||
clickhouse_program_install(clickhouse-checksum-for-compressed-block checksum-for-compressed-block)
|
||||
clickhouse_program_install(clickhouse-client client chc)
|
||||
clickhouse_program_install(clickhouse-compressor compressor)
|
||||
clickhouse_program_install(clickhouse-format format)
|
||||
clickhouse_program_install(clickhouse-obfuscator obfuscator)
|
||||
clickhouse_program_install(clickhouse-git-import git-import)
|
||||
clickhouse_program_install(clickhouse-static-files-disk-uploader static-files-disk-uploader)
|
||||
clickhouse_program_install(clickhouse-disks disks)
|
||||
clickhouse_program_install(clickhouse-extract-from-config extract-from-config)
|
||||
clickhouse_program_install(clickhouse-format format)
|
||||
clickhouse_program_install(clickhouse-git-import git-import)
|
||||
clickhouse_program_install(clickhouse-keeper-bench keeper-bench)
|
||||
clickhouse_program_install(clickhouse-keeper-data-dumper keeper-data-dumper)
|
||||
clickhouse_program_install(clickhouse-local local chl ch)
|
||||
clickhouse_program_install(clickhouse-obfuscator obfuscator)
|
||||
clickhouse_program_install(clickhouse-server server)
|
||||
clickhouse_program_install(clickhouse-static-files-disk-uploader static-files-disk-uploader)
|
||||
clickhouse_program_install(clickhouse-su su)
|
||||
clickhouse_program_install(clickhouse-zookeeper-dump-tree zookeeper-dump-tree)
|
||||
clickhouse_program_install(clickhouse-zookeeper-remove-by-list zookeeper-remove-by-list)
|
||||
|
||||
if (ENABLE_CLICKHOUSE_KEEPER)
|
||||
if (NOT BUILD_STANDALONE_KEEPER AND CREATE_KEEPER_SYMLINK)
|
||||
|
11
programs/check-marks/CMakeLists.txt
Normal file
11
programs/check-marks/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
set (CLICKHOUSE_CHECK_MARKS_SOURCES CheckMarks.cpp)
|
||||
|
||||
set (CLICKHOUSE_CHECK_MARKS_LINK
|
||||
PRIVATE
|
||||
boost::program_options
|
||||
clickhouse_aggregate_functions
|
||||
clickhouse_common_config
|
||||
dbms
|
||||
)
|
||||
|
||||
clickhouse_program_add(check-marks)
|
@ -54,7 +54,7 @@ static void checkByCompressedReadBuffer(const std::string & mrk_path, const std:
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
int mainEntryClickHouseCheckMarks(int argc, char ** argv)
|
||||
{
|
||||
boost::program_options::options_description desc("Allowed options");
|
||||
desc.add_options()
|
1
programs/check-marks/check-marks.cpp
Normal file
1
programs/check-marks/check-marks.cpp
Normal file
@ -0,0 +1 @@
|
||||
extern int mainEntryClickHouseCheckMarks(int argc, char ** argv);
|
9
programs/checksum-for-compressed-block/CMakeLists.txt
Normal file
9
programs/checksum-for-compressed-block/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
set (CLICKHOUSE_CHECKSUM_FOR_COMPRESSED_BLOCK_SOURCES ChecksumForCompressedBlock.cpp)
|
||||
|
||||
set (CLICKHOUSE_CHECKSUM_FOR_COMPRESSED_BLOCK_LINK
|
||||
PRIVATE
|
||||
clickhouse_functions
|
||||
dbms
|
||||
)
|
||||
|
||||
clickhouse_program_add(checksum-for-compressed-block)
|
@ -34,7 +34,7 @@ std::string flipBit(std::string s, size_t pos)
|
||||
}
|
||||
|
||||
|
||||
int main(int, char **)
|
||||
int mainEntryClickHouseChecksumForCompressedBlock(int, char **)
|
||||
{
|
||||
using namespace DB;
|
||||
ReadBufferFromFileDescriptor in(STDIN_FILENO);
|
@ -0,0 +1 @@
|
||||
extern int mainEntryClickHouseChecksumForCompressedBlock(int, char **);
|
20
programs/keeper-bench/CMakeLists.txt
Normal file
20
programs/keeper-bench/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
||||
if (NOT TARGET ch_contrib::rapidjson)
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Not building keeper-bench due to rapidjson is disabled")
|
||||
return()
|
||||
endif ()
|
||||
|
||||
set (CLICKHOUSE_KEEPER_BENCH_SOURCES
|
||||
Generator.cpp
|
||||
Runner.cpp
|
||||
Stats.cpp
|
||||
KeeperBench.cpp
|
||||
)
|
||||
|
||||
set (CLICKHOUSE_KEEPER_BENCH_LINK
|
||||
PRIVATE
|
||||
dbms
|
||||
clickhouse_functions
|
||||
ch_contrib::rapidjson
|
||||
)
|
||||
|
||||
clickhouse_program_add(keeper-bench)
|
@ -20,7 +20,7 @@ std::optional<T> valueToOptional(const boost::program_options::variable_value &
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int mainEntryClickHouseKeeperBench(int argc, char ** argv)
|
||||
{
|
||||
|
||||
bool print_stacktrace = true;
|
1
programs/keeper-bench/keeper-bench.cpp
Normal file
1
programs/keeper-bench/keeper-bench.cpp
Normal file
@ -0,0 +1 @@
|
||||
extern int mainEntryClickHouseKeeperBench(int argc, char ** argv);
|
14
programs/keeper-data-dumper/CMakeLists.txt
Normal file
14
programs/keeper-data-dumper/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
if (NOT TARGET ch_contrib::nuraft)
|
||||
message (WARNING "Not building keeper-data-dumper due to nuraft is disabled")
|
||||
return ()
|
||||
endif ()
|
||||
|
||||
set (CLICKHOUSE_KEEPER_DATA_DUMPER_SOURCES KeeperDataDumper.cpp)
|
||||
|
||||
set (CLICKHOUSE_KEEPER_DATA_DUMPER_LINK
|
||||
PRIVATE
|
||||
clickhouse_functions
|
||||
dbms
|
||||
)
|
||||
|
||||
clickhouse_program_add(keeper-data-dumper)
|
@ -54,7 +54,7 @@ void dumpMachine(std::shared_ptr<KeeperStateMachine<DB::KeeperMemoryStorage>> ma
|
||||
std::cout << std::flush;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int mainEntryClickHouseKeeperDataDumper(int argc, char ** argv)
|
||||
{
|
||||
if (argc != 3)
|
||||
{
|
1
programs/keeper-data-dumper/keeper-data-dumper.cpp
Normal file
1
programs/keeper-data-dumper/keeper-data-dumper.cpp
Normal file
@ -0,0 +1 @@
|
||||
extern int mainEntryClickHouseKeeperDataDumper(int argc, char ** argv);
|
@ -20,18 +20,24 @@
|
||||
#include <vector>
|
||||
|
||||
/// Universal executable for various clickhouse applications
|
||||
int mainEntryClickHouseServer(int argc, char ** argv);
|
||||
int mainEntryClickHouseClient(int argc, char ** argv);
|
||||
int mainEntryClickHouseLocal(int argc, char ** argv);
|
||||
int mainEntryClickHouseBenchmark(int argc, char ** argv);
|
||||
int mainEntryClickHouseExtractFromConfig(int argc, char ** argv);
|
||||
int mainEntryClickHouseCheckMarks(int argc, char ** argv);
|
||||
int mainEntryClickHouseChecksumForCompressedBlock(int, char **);
|
||||
int mainEntryClickHouseClient(int argc, char ** argv);
|
||||
int mainEntryClickHouseCompressor(int argc, char ** argv);
|
||||
int mainEntryClickHouseFormat(int argc, char ** argv);
|
||||
int mainEntryClickHouseObfuscator(int argc, char ** argv);
|
||||
int mainEntryClickHouseGitImport(int argc, char ** argv);
|
||||
int mainEntryClickHouseStaticFilesDiskUploader(int argc, char ** argv);
|
||||
int mainEntryClickHouseSU(int argc, char ** argv);
|
||||
int mainEntryClickHouseDisks(int argc, char ** argv);
|
||||
int mainEntryClickHouseExtractFromConfig(int argc, char ** argv);
|
||||
int mainEntryClickHouseFormat(int argc, char ** argv);
|
||||
int mainEntryClickHouseGitImport(int argc, char ** argv);
|
||||
int mainEntryClickHouseKeeperBench(int argc, char ** argv);
|
||||
int mainEntryClickHouseKeeperDataDumper(int argc, char ** argv);
|
||||
int mainEntryClickHouseLocal(int argc, char ** argv);
|
||||
int mainEntryClickHouseObfuscator(int argc, char ** argv);
|
||||
int mainEntryClickHouseSU(int argc, char ** argv);
|
||||
int mainEntryClickHouseServer(int argc, char ** argv);
|
||||
int mainEntryClickHouseStaticFilesDiskUploader(int argc, char ** argv);
|
||||
int mainEntryClickHouseZooKeeperDumpTree(int argc, char ** argv);
|
||||
int mainEntryClickHouseZooKeeperRemoveByList(int argc, char ** argv);
|
||||
|
||||
int mainEntryClickHouseHashBinary(int, char **)
|
||||
{
|
||||
@ -66,19 +72,25 @@ using MainFunc = int (*)(int, char**);
|
||||
/// Add an item here to register new application
|
||||
std::pair<std::string_view, MainFunc> clickhouse_applications[] =
|
||||
{
|
||||
{"local", mainEntryClickHouseLocal},
|
||||
{"client", mainEntryClickHouseClient},
|
||||
{"benchmark", mainEntryClickHouseBenchmark},
|
||||
{"server", mainEntryClickHouseServer},
|
||||
{"extract-from-config", mainEntryClickHouseExtractFromConfig},
|
||||
{"check-marks", mainEntryClickHouseCheckMarks},
|
||||
{"checksum-for-compressed-block", mainEntryClickHouseChecksumForCompressedBlock},
|
||||
{"client", mainEntryClickHouseClient},
|
||||
{"compressor", mainEntryClickHouseCompressor},
|
||||
{"disks", mainEntryClickHouseDisks},
|
||||
{"extract-from-config", mainEntryClickHouseExtractFromConfig},
|
||||
{"format", mainEntryClickHouseFormat},
|
||||
{"obfuscator", mainEntryClickHouseObfuscator},
|
||||
{"git-import", mainEntryClickHouseGitImport},
|
||||
{"hash-binary", mainEntryClickHouseHashBinary},
|
||||
{"keeper-bench", mainEntryClickHouseKeeperBench},
|
||||
{"keeper-data-dumper", mainEntryClickHouseKeeperDataDumper},
|
||||
{"local", mainEntryClickHouseLocal},
|
||||
{"obfuscator", mainEntryClickHouseObfuscator},
|
||||
{"server", mainEntryClickHouseServer},
|
||||
{"static-files-disk-uploader", mainEntryClickHouseStaticFilesDiskUploader},
|
||||
{"su", mainEntryClickHouseSU},
|
||||
{"hash-binary", mainEntryClickHouseHashBinary},
|
||||
{"disks", mainEntryClickHouseDisks},
|
||||
{"zookeeper-dump-tree", mainEntryClickHouseZooKeeperDumpTree},
|
||||
{"zookeeper-remove-by-list", mainEntryClickHouseZooKeeperRemoveByList},
|
||||
|
||||
// keeper
|
||||
#if ENABLE_CLICKHOUSE_KEEPER
|
||||
|
12
programs/zookeeper-dump-tree/CMakeLists.txt
Normal file
12
programs/zookeeper-dump-tree/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
set (CLICKHOUSE_ZOOKEEPER_DUMP_TREE_SOURCES ZooKeeperDumpTree.cpp)
|
||||
|
||||
set (CLICKHOUSE_ZOOKEEPER_DUMP_TREE_LINK
|
||||
PRIVATE
|
||||
clickhouse_common_zookeeper_no_log
|
||||
clickhouse_common_io
|
||||
dbms
|
||||
clickhouse_functions
|
||||
boost::program_options
|
||||
)
|
||||
|
||||
clickhouse_program_add(zookeeper-dump-tree)
|
@ -6,7 +6,7 @@
|
||||
#include <Common/ZooKeeper/KeeperException.h>
|
||||
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
int mainEntryClickHouseZooKeeperDumpTree(int argc, char ** argv)
|
||||
{
|
||||
try
|
||||
{
|
1
programs/zookeeper-dump-tree/zookeeper-dump-tree.cpp
Normal file
1
programs/zookeeper-dump-tree/zookeeper-dump-tree.cpp
Normal file
@ -0,0 +1 @@
|
||||
extern int mainEntryClickHouseZooKeeperDumpTree(int argc, char ** argv);
|
12
programs/zookeeper-remove-by-list/CMakeLists.txt
Normal file
12
programs/zookeeper-remove-by-list/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
set (CLICKHOUSE_ZOOKEEPER_REMOVE_BY_LIST_SOURCES ZooKeeperRemoveByList.cpp)
|
||||
|
||||
set (CLICKHOUSE_ZOOKEEPER_REMOVE_BY_LIST_LINK
|
||||
PRIVATE
|
||||
clickhouse_common_zookeeper_no_log
|
||||
clickhouse_common_io
|
||||
dbms
|
||||
clickhouse_functions
|
||||
boost::program_options
|
||||
)
|
||||
|
||||
clickhouse_program_add(zookeeper-remove-by-list)
|
@ -5,7 +5,7 @@
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
int mainEntryClickHouseZooKeeperRemoveByList(int argc, char ** argv)
|
||||
try
|
||||
{
|
||||
boost::program_options::options_description desc("Allowed options");
|
@ -0,0 +1 @@
|
||||
extern int mainEntryClickHouseZooKeeperRemoveByList(int argc, char ** argv);
|
@ -1,2 +1,5 @@
|
||||
clickhouse_add_executable (compressed_buffer compressed_buffer.cpp)
|
||||
target_link_libraries (compressed_buffer PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression)
|
||||
|
||||
clickhouse_add_executable (decompress_perf decompress_perf.cpp)
|
||||
target_link_libraries(decompress_perf PRIVATE dbms clickhouse_functions ch_contrib::lz4)
|
||||
|
@ -164,6 +164,17 @@ public:
|
||||
}
|
||||
|
||||
|
||||
/* Usage example:
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
./clickhouse-compressor < clickhouse-compressor > compressed
|
||||
./clickhouse-compressor -d < compressed > clickhouse-compressor2
|
||||
cmp clickhouse-compressor clickhouse-compressor2 && echo "Ok." || echo "Fail."
|
||||
|
||||
*/
|
||||
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
try
|
||||
{
|
@ -11,7 +11,6 @@ endif ()
|
||||
|
||||
# Not used in packages
|
||||
if (ENABLE_UTILS)
|
||||
add_subdirectory (compressor)
|
||||
add_subdirectory (corrector_utf8)
|
||||
add_subdirectory (zookeeper-cli)
|
||||
add_subdirectory (zookeeper-dump-tree)
|
||||
@ -23,7 +22,3 @@ if (ENABLE_UTILS)
|
||||
add_subdirectory (keeper-data-dumper)
|
||||
add_subdirectory (memcpy-bench)
|
||||
endif ()
|
||||
|
||||
if (ENABLE_FUZZING AND ENABLE_FUZZER_TEST)
|
||||
add_subdirectory (libfuzzer-test)
|
||||
endif ()
|
||||
|
@ -1,2 +0,0 @@
|
||||
clickhouse_add_executable (check-marks main.cpp)
|
||||
target_link_libraries(check-marks PRIVATE dbms clickhouse_functions boost::program_options)
|
@ -1,2 +0,0 @@
|
||||
clickhouse_add_executable(check-mysql-binlog main.cpp)
|
||||
target_link_libraries(check-mysql-binlog PRIVATE dbms clickhouse_functions boost::program_options)
|
@ -1,98 +0,0 @@
|
||||
#include <IO/WriteBufferFromOStream.h>
|
||||
#include <Databases/MySQL/MySQLBinlog.h>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <iostream>
|
||||
|
||||
bool quit = false;
|
||||
void signal_handler(int)
|
||||
{
|
||||
quit = true;
|
||||
}
|
||||
|
||||
static void processBinlogFromFile(const std::string & bin_path, bool disable_checksum)
|
||||
{
|
||||
DB::MySQLReplication::BinlogFromFile binlog;
|
||||
binlog.open(bin_path);
|
||||
binlog.setChecksum(disable_checksum ? DB::MySQLReplication::IBinlog::NONE : DB::MySQLReplication::IBinlog::CRC32);
|
||||
|
||||
DB::MySQLReplication::BinlogEventPtr event;
|
||||
while (binlog.tryReadEvent(event, /*timeout*/ 0) && !quit)
|
||||
{
|
||||
DB::WriteBufferFromOStream cout(std::cout);
|
||||
event->dump(cout);
|
||||
binlog.getPosition().dump(cout);
|
||||
cout.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
static void processBinlogFromSocket(const std::string & host, int port, const std::string & user, const std::string & password, const std::string & executed_gtid_set, bool disable_checksum)
|
||||
{
|
||||
DB::MySQLReplication::BinlogFromSocket binlog;
|
||||
binlog.setChecksum(disable_checksum ? DB::MySQLReplication::IBinlog::NONE : DB::MySQLReplication::IBinlog::CRC32);
|
||||
|
||||
binlog.connect(host, port, user, password);
|
||||
binlog.start(/*unique number*/ 42, executed_gtid_set);
|
||||
DB::MySQLReplication::BinlogEventPtr event;
|
||||
|
||||
while (!quit)
|
||||
{
|
||||
if (binlog.tryReadEvent(event, /*timeout*/ 100))
|
||||
{
|
||||
if (event->header.type != DB::MySQLReplication::HEARTBEAT_EVENT)
|
||||
{
|
||||
DB::WriteBufferFromOStream cout(std::cout);
|
||||
event->dump(cout);
|
||||
binlog.getPosition().dump(cout);
|
||||
cout.finalize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
(void)signal(SIGINT, signal_handler);
|
||||
boost::program_options::options_description desc("Allowed options");
|
||||
|
||||
std::string host = "127.0.0.1";
|
||||
int port = 3306;
|
||||
std::string user = "root";
|
||||
std::string password;
|
||||
std::string gtid;
|
||||
|
||||
desc.add_options()
|
||||
("help", "Produce help message")
|
||||
("disable_checksum", "Disable checksums in binlog files.")
|
||||
("binlog", boost::program_options::value<std::string>(), "Binlog file")
|
||||
("host", boost::program_options::value<std::string>(&host)->default_value(host), "Host to connect")
|
||||
("port", boost::program_options::value<int>(&port)->default_value(port), "Port number to connect")
|
||||
("user", boost::program_options::value<std::string>(&user)->default_value(user), "User")
|
||||
("password", boost::program_options::value<std::string>(&password), "Password")
|
||||
("gtid", boost::program_options::value<std::string>(>id), "Executed gtid set");
|
||||
|
||||
try
|
||||
{
|
||||
boost::program_options::variables_map options;
|
||||
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), options);
|
||||
boost::program_options::notify(options);
|
||||
|
||||
if (options.count("help") || (!options.count("binlog") && !options.count("gtid")))
|
||||
{
|
||||
std::cout << "Usage: " << argv[0] << std::endl;
|
||||
std::cout << desc << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (options.count("binlog"))
|
||||
processBinlogFromFile(options["binlog"].as<std::string>(), options.count("disable_checksum"));
|
||||
else
|
||||
processBinlogFromSocket(host, port, user, password, gtid, options.count("disable_checksum"));
|
||||
}
|
||||
catch (std::exception & ex)
|
||||
{
|
||||
std::cerr << ex.what() << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
clickhouse_add_executable (checksum-for-compressed-block-find-bit-flips main.cpp)
|
||||
target_link_libraries(checksum-for-compressed-block-find-bit-flips PRIVATE dbms clickhouse_functions)
|
@ -1,2 +0,0 @@
|
||||
clickhouse_add_executable (decompress_perf decompress_perf.cpp)
|
||||
target_link_libraries(decompress_perf PRIVATE dbms clickhouse_functions ch_contrib::lz4)
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
./clickhouse-compressor < clickhouse-compressor > compressed
|
||||
./clickhouse-compressor -d < compressed > clickhouse-compressor2
|
||||
cmp clickhouse-compressor clickhouse-compressor2 && echo "Ok." || echo "Fail."
|
@ -1,7 +0,0 @@
|
||||
if (NOT TARGET ch_contrib::rapidjson)
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Not building keeper-bench due to rapidjson is disabled")
|
||||
return()
|
||||
endif ()
|
||||
|
||||
clickhouse_add_executable(keeper-bench Generator.cpp Runner.cpp Stats.cpp main.cpp)
|
||||
target_link_libraries(keeper-bench PRIVATE dbms clickhouse_functions ch_contrib::rapidjson)
|
@ -1,7 +0,0 @@
|
||||
if (NOT TARGET ch_contrib::nuraft)
|
||||
message (WARNING "Not building keeper-data-dumper due to nuraft is disabled")
|
||||
return ()
|
||||
endif ()
|
||||
|
||||
clickhouse_add_executable(keeper-data-dumper main.cpp)
|
||||
target_link_libraries(keeper-data-dumper PRIVATE dbms clickhouse_functions)
|
@ -1 +0,0 @@
|
||||
add_subdirectory (test_basic_fuzzer)
|
@ -1 +0,0 @@
|
||||
This folder contains various stuff intended to test libfuzzer functionality.
|
@ -1 +0,0 @@
|
||||
add_executable (test_basic_fuzzer main.cpp)
|
@ -1,11 +0,0 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
if (size > 0 && data[0] == 'H')
|
||||
if (size > 1 && data[1] == 'I')
|
||||
if (size > 2 && data[2] == '!')
|
||||
__builtin_trap();
|
||||
return 0;
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
clickhouse_add_executable(clickhouse-zookeeper-cli
|
||||
zookeeper-cli.cpp
|
||||
${ClickHouse_SOURCE_DIR}/src/Client/LineReader.cpp)
|
||||
target_link_libraries(clickhouse-zookeeper-cli PRIVATE
|
||||
clickhouse_common_zookeeper_base
|
||||
clickhouse_common_zookeeper_no_log
|
||||
dbms
|
||||
clickhouse_functions
|
||||
)
|
@ -1,223 +0,0 @@
|
||||
#include <IO/ReadBufferFromString.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <Poco/ConsoleChannel.h>
|
||||
#include <Common/ZooKeeper/KeeperException.h>
|
||||
#include <Common/ZooKeeper/ZooKeeper.h>
|
||||
#include <Client/LineReader.h>
|
||||
#include <Common/logger_useful.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
void printStat(const Coordination::Stat & s)
|
||||
{
|
||||
std::cout << "Stat:\n";
|
||||
std::cout << " czxid: " << s.czxid << '\n';
|
||||
std::cout << " mzxid: " << s.mzxid << '\n';
|
||||
std::cout << " ctime: " << s.ctime << '\n';
|
||||
std::cout << " mtime: " << s.mtime << '\n';
|
||||
std::cout << " version: " << s.version << '\n';
|
||||
std::cout << " cversion: " << s.cversion << '\n';
|
||||
std::cout << " aversion: " << s.aversion << '\n';
|
||||
std::cout << " ephemeralOwner: " << s.ephemeralOwner << '\n';
|
||||
std::cout << " dataLength: " << s.dataLength << '\n';
|
||||
std::cout << " numChildren: " << s.numChildren << '\n';
|
||||
std::cout << " pzxid: " << s.pzxid << std::endl;
|
||||
}
|
||||
|
||||
void waitForWatch(const zkutil::EventPtr & event)
|
||||
{
|
||||
std::cout << "waiting for watch" << std::endl;
|
||||
event->wait();
|
||||
std::cout << "watch event was signalled" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void readUntilSpace(std::string & s, DB::ReadBuffer & buf)
|
||||
{
|
||||
s = "";
|
||||
while (!buf.eof())
|
||||
{
|
||||
if (isspace(*buf.position()))
|
||||
return;
|
||||
s.push_back(*buf.position());
|
||||
++buf.position();
|
||||
}
|
||||
}
|
||||
|
||||
void readMaybeQuoted(std::string & s, DB::ReadBuffer & buf)
|
||||
{
|
||||
if (!buf.eof() && *buf.position() == '\'')
|
||||
DB::readQuotedString(s, buf);
|
||||
else
|
||||
readUntilSpace(s, buf);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
std::cerr << "usage: " << argv[0] << " hosts" << std::endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
Poco::AutoPtr<Poco::ConsoleChannel> channel = new Poco::ConsoleChannel(std::cerr);
|
||||
Poco::Logger::root().setChannel(channel);
|
||||
Poco::Logger::root().setLevel("trace");
|
||||
|
||||
auto zk = zkutil::ZooKeeper::createWithoutKillingPreviousSessions(zkutil::ZooKeeperArgs(argv[1]));
|
||||
DB::LineReader lr({}, false, {"\\"}, {});
|
||||
|
||||
do
|
||||
{
|
||||
const auto & line = lr.readLine(":3 ", ":3 ");
|
||||
if (line.empty())
|
||||
break;
|
||||
|
||||
try
|
||||
{
|
||||
std::stringstream ss(line); // STYLE_CHECK_ALLOW_STD_STRING_STREAM
|
||||
|
||||
std::string cmd;
|
||||
ss >> cmd;
|
||||
|
||||
if (cmd == "q" || cmd == "quit" || cmd == "exit" || cmd == ":q")
|
||||
break;
|
||||
|
||||
std::string path;
|
||||
ss >> path;
|
||||
if (cmd == "ls")
|
||||
{
|
||||
std::string w;
|
||||
ss >> w;
|
||||
bool watch = w == "w";
|
||||
zkutil::EventPtr event = watch ? std::make_shared<Poco::Event>() : nullptr;
|
||||
std::vector<std::string> v = zk->getChildren(path, nullptr, event);
|
||||
for (const auto & child : v)
|
||||
std::cout << child << std::endl;
|
||||
if (watch)
|
||||
waitForWatch(event);
|
||||
}
|
||||
else if (cmd == "create")
|
||||
{
|
||||
DB::ReadBufferFromString in(line);
|
||||
|
||||
std::string path_ignored;
|
||||
std::string data;
|
||||
std::string mode;
|
||||
|
||||
DB::assertString("create", in);
|
||||
DB::skipWhitespaceIfAny(in);
|
||||
readMaybeQuoted(path_ignored, in);
|
||||
DB::skipWhitespaceIfAny(in);
|
||||
readMaybeQuoted(data, in);
|
||||
DB::skipWhitespaceIfAny(in);
|
||||
readUntilSpace(mode, in);
|
||||
|
||||
int32_t m;
|
||||
if (mode == "p")
|
||||
m = zkutil::CreateMode::Persistent;
|
||||
else if (mode == "ps")
|
||||
m = zkutil::CreateMode::PersistentSequential;
|
||||
else if (mode == "e")
|
||||
m = zkutil::CreateMode::Ephemeral;
|
||||
else if (mode == "es")
|
||||
m = zkutil::CreateMode::EphemeralSequential;
|
||||
else
|
||||
{
|
||||
std::cout << "Bad create mode" << std::endl;
|
||||
continue;
|
||||
}
|
||||
std::cout << zk->create(path, data, m) << std::endl;
|
||||
}
|
||||
else if (cmd == "remove")
|
||||
{
|
||||
zk->remove(path);
|
||||
}
|
||||
else if (cmd == "rmr")
|
||||
{
|
||||
zk->removeRecursive(path);
|
||||
}
|
||||
else if (cmd == "exists")
|
||||
{
|
||||
std::string w;
|
||||
ss >> w;
|
||||
bool watch = w == "w";
|
||||
zkutil::EventPtr event = watch ? std::make_shared<Poco::Event>() : nullptr;
|
||||
Coordination::Stat stat;
|
||||
bool e = zk->exists(path, &stat, event);
|
||||
if (e)
|
||||
printStat(stat);
|
||||
else
|
||||
std::cout << path << " does not exist" << std::endl;
|
||||
if (watch)
|
||||
waitForWatch(event);
|
||||
}
|
||||
else if (cmd == "get")
|
||||
{
|
||||
std::string w;
|
||||
ss >> w;
|
||||
bool watch = w == "w";
|
||||
zkutil::EventPtr event = watch ? std::make_shared<Poco::Event>() : nullptr;
|
||||
Coordination::Stat stat;
|
||||
std::string data = zk->get(path, &stat, event);
|
||||
std::cout << "Data: " << data << std::endl;
|
||||
printStat(stat);
|
||||
if (watch)
|
||||
waitForWatch(event);
|
||||
}
|
||||
else if (cmd == "set")
|
||||
{
|
||||
DB::ReadBufferFromString in(line);
|
||||
|
||||
std::string data;
|
||||
int version = -1;
|
||||
|
||||
DB::assertString("set", in);
|
||||
DB::skipWhitespaceIfAny(in);
|
||||
DB::assertString(path, in);
|
||||
DB::skipWhitespaceIfAny(in);
|
||||
readMaybeQuoted(data, in);
|
||||
DB::skipWhitespaceIfAny(in);
|
||||
|
||||
if (!in.eof())
|
||||
DB::readText(version, in);
|
||||
|
||||
Coordination::Stat stat;
|
||||
zk->set(path, data, version, &stat);
|
||||
printStat(stat);
|
||||
}
|
||||
else if (!cmd.empty())
|
||||
{
|
||||
std::cout << "commands:\n";
|
||||
std::cout << " q\n";
|
||||
std::cout << " ls path [w]\n";
|
||||
std::cout << " create path data (p|ps|e|es)\n";
|
||||
std::cout << " remove path\n";
|
||||
std::cout << " rmr path\n";
|
||||
std::cout << " exists path [w]\n";
|
||||
std::cout << " get path [w]\n";
|
||||
std::cout << " set path data [version]" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
catch (const Coordination::Exception & e)
|
||||
{
|
||||
std::cerr << "KeeperException: " << e.displayText() << std::endl;
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
catch (const Coordination::Exception & e)
|
||||
{
|
||||
std::cerr << "KeeperException: " << e.displayText() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
clickhouse_add_executable (zookeeper-dump-tree main.cpp ${SRCS})
|
||||
target_link_libraries(zookeeper-dump-tree PRIVATE
|
||||
clickhouse_common_zookeeper_base
|
||||
clickhouse_common_zookeeper_no_log
|
||||
clickhouse_common_io
|
||||
dbms
|
||||
clickhouse_functions
|
||||
boost::program_options)
|
@ -1,7 +0,0 @@
|
||||
clickhouse_add_executable (zookeeper-remove-by-list main.cpp ${SRCS})
|
||||
target_link_libraries(zookeeper-remove-by-list PRIVATE
|
||||
clickhouse_common_zookeeper_base
|
||||
clickhouse_common_zookeeper_no_log
|
||||
dbms
|
||||
clickhouse_functions
|
||||
boost::program_options)
|
Loading…
Reference in New Issue
Block a user