Style [#CLICKHOUSE-2].

This commit is contained in:
Alexey Milovidov 2017-02-13 13:38:50 +03:00
parent bb7247993a
commit 8f9b70a1d7
5 changed files with 17 additions and 11 deletions

View File

@ -1,3 +1,3 @@
#pragma once
extern const char* const char_to_digit_table;
extern const char * const char_to_digit_table;

View File

@ -612,7 +612,7 @@ public:
out_offset < vec_res.size();
out_offset += ipv6_bytes_length, ++i)
{
ipv6_scan(reinterpret_cast<const char* >(&vec_src[src_offset]), &vec_res[out_offset]);
ipv6_scan(reinterpret_cast<const char * >(&vec_src[src_offset]), &vec_res[out_offset]);
src_offset = offsets_src[i];
}
}

View File

@ -37,7 +37,7 @@ void throwFromErrno(const std::string & s, int code, int e)
#endif
{
std::string tmp = std::to_string(code);
const char* code = tmp.c_str();
const char * code = tmp.c_str();
strcpy(buf, unknown_message);
strcpy(buf + strlen(unknown_message), code);
}

View File

@ -1,6 +1,6 @@
#include <DB/Common/hex.h>
const char* const char_to_digit_table = (
const char * const char_to_digit_table = (
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"

View File

@ -42,11 +42,11 @@ namespace
for (auto it = boost::make_split_iterator(name, boost::first_finder(",")); it != decltype(it){}; ++it)
{
const auto address = boost::copy_range<std::string>(*it);
const char* address_begin = static_cast<const char*>(address.data());
const char* address_end = address_begin + address.size();
const char * address_begin = static_cast<const char*>(address.data());
const char * address_end = address_begin + address.size();
const char* user_pw_end = strchr(address.data(), '@');
const char* colon = strchr(address.data(), ':');
const char * user_pw_end = strchr(address.data(), '@');
const char * colon = strchr(address.data(), ':');
if (!user_pw_end || !colon)
throw Exception{
"Shard address '" + address + "' does not match to 'user[:password]@host:port#default_database' pattern",
@ -54,15 +54,15 @@ namespace
};
const bool has_pw = colon < user_pw_end;
const char* host_end = has_pw ? strchr(user_pw_end + 1, ':') : colon;
const char * host_end = has_pw ? strchr(user_pw_end + 1, ':') : colon;
if (!host_end)
throw Exception{
"Shard address '" + address + "' does not contain port",
ErrorCodes::INCORRECT_FILE_NAME
};
const char* has_db = strchr(address.data(), '#');
const char* port_end = has_db ? has_db : address_end;
const char * has_db = strchr(address.data(), '#');
const char * port_end = has_db ? has_db : address_end;
const auto user = unescapeForFileName(std::string(address_begin, has_pw ? colon : user_pw_end));
const auto password = has_pw ? unescapeForFileName(std::string(colon + 1, user_pw_end)) : std::string();
@ -87,6 +87,7 @@ StorageDistributedDirectoryMonitor::StorageDistributedDirectoryMonitor(StorageDi
{
}
StorageDistributedDirectoryMonitor::~StorageDistributedDirectoryMonitor()
{
{
@ -97,6 +98,7 @@ StorageDistributedDirectoryMonitor::~StorageDistributedDirectoryMonitor()
thread.join();
}
void StorageDistributedDirectoryMonitor::run()
{
setThreadName("DistrDirMonitor");
@ -135,6 +137,7 @@ void StorageDistributedDirectoryMonitor::run()
}
}
ConnectionPoolPtr StorageDistributedDirectoryMonitor::createPool(const std::string & name)
{
const auto pool_factory = [this, &name] (const std::string & host, const UInt16 port,
@ -152,6 +155,7 @@ ConnectionPoolPtr StorageDistributedDirectoryMonitor::createPool(const std::stri
return pools.size() == 1 ? pools.front() : std::make_shared<ConnectionPoolWithFailover>(pools, LoadBalancing::RANDOM);
}
bool StorageDistributedDirectoryMonitor::findFiles()
{
std::map<UInt64, std::string> files;
@ -180,6 +184,7 @@ bool StorageDistributedDirectoryMonitor::findFiles()
return true;
}
void StorageDistributedDirectoryMonitor::processFile(const std::string & file_path)
{
LOG_TRACE(log, "Started processing `" << file_path << '`');
@ -229,6 +234,7 @@ void StorageDistributedDirectoryMonitor::processFile(const std::string & file_pa
LOG_TRACE(log, "Finished processing `" << file_path << '`');
}
std::string StorageDistributedDirectoryMonitor::getLoggerName() const
{
return storage.name + '.' + storage.getName() + ".DirectoryMonitor";