mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Fix compilation.
This commit is contained in:
parent
78bcb96098
commit
1c0b731ea6
@ -5,8 +5,6 @@
|
|||||||
#include <IO/WriteBufferFromFileBase.h>
|
#include <IO/WriteBufferFromFileBase.h>
|
||||||
#include <base/logger_useful.h>
|
#include <base/logger_useful.h>
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
@ -182,12 +182,12 @@ void BackupImpl::open()
|
|||||||
if (open_mode == OpenMode::WRITE)
|
if (open_mode == OpenMode::WRITE)
|
||||||
{
|
{
|
||||||
if (backup_exists)
|
if (backup_exists)
|
||||||
throw Exception(ErrorCodes::BACKUP_ALREADY_EXISTS, "Backup {} already exists", getName());
|
throw Exception(ErrorCodes::BACKUP_ALREADY_EXISTS, "Backup {} already exists", backup_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!backup_exists)
|
if (!backup_exists)
|
||||||
throw Exception(ErrorCodes::BACKUP_NOT_FOUND, "Backup {} not found", getName());
|
throw Exception(ErrorCodes::BACKUP_NOT_FOUND, "Backup {} not found", backup_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open_mode == OpenMode::WRITE)
|
if (open_mode == OpenMode::WRITE)
|
||||||
@ -215,7 +215,7 @@ void BackupImpl::open()
|
|||||||
base_backup_uuid = base_backup->getUUID();
|
base_backup_uuid = base_backup->getUUID();
|
||||||
else if (base_backup_uuid != base_backup->getUUID())
|
else if (base_backup_uuid != base_backup->getUUID())
|
||||||
throw Exception(ErrorCodes::WRONG_BASE_BACKUP, "Backup {}: The base backup {} has different UUID ({} != {})",
|
throw Exception(ErrorCodes::WRONG_BASE_BACKUP, "Backup {}: The base backup {} has different UUID ({} != {})",
|
||||||
getName(), base_backup->getName(), toString(base_backup->getUUID()), (base_backup_uuid ? toString(*base_backup_uuid) : ""));
|
backup_name, base_backup->getName(), toString(base_backup->getUUID()), (base_backup_uuid ? toString(*base_backup_uuid) : ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ void BackupImpl::readBackupMetadata()
|
|||||||
|
|
||||||
version = config->getUInt("version");
|
version = config->getUInt("version");
|
||||||
if ((version < INITIAL_BACKUP_VERSION) || (version > CURRENT_BACKUP_VERSION))
|
if ((version < INITIAL_BACKUP_VERSION) || (version > CURRENT_BACKUP_VERSION))
|
||||||
throw Exception(ErrorCodes::BACKUP_VERSION_NOT_SUPPORTED, "Backup {}: Version {} is not supported", getName(), version);
|
throw Exception(ErrorCodes::BACKUP_VERSION_NOT_SUPPORTED, "Backup {}: Version {} is not supported", backup_name, version);
|
||||||
|
|
||||||
timestamp = parse<LocalDateTime>(config->getString("timestamp")).to_time_t();
|
timestamp = parse<LocalDateTime>(config->getString("timestamp")).to_time_t();
|
||||||
uuid = parse<UUID>(config->getString("uuid"));
|
uuid = parse<UUID>(config->getString("uuid"));
|
||||||
@ -353,7 +353,7 @@ void BackupImpl::readBackupMetadata()
|
|||||||
use_base = true;
|
use_base = true;
|
||||||
|
|
||||||
if (info.base_size > info.size)
|
if (info.base_size > info.size)
|
||||||
throw Exception(ErrorCodes::BACKUP_DAMAGED, "Backup {}: Base size must not be greater than the size of entry {}", getName(), quoteString(info.file_name));
|
throw Exception(ErrorCodes::BACKUP_DAMAGED, "Backup {}: Base size must not be greater than the size of entry {}", backup_name, quoteString(info.file_name));
|
||||||
|
|
||||||
if (use_base)
|
if (use_base)
|
||||||
{
|
{
|
||||||
@ -402,7 +402,7 @@ UInt64 BackupImpl::getFileSize(const String & file_name) const
|
|||||||
auto info = coordination->getFileInfo(file_name);
|
auto info = coordination->getFileInfo(file_name);
|
||||||
if (!info)
|
if (!info)
|
||||||
throw Exception(
|
throw Exception(
|
||||||
ErrorCodes::BACKUP_ENTRY_NOT_FOUND, "Backup {}: Entry {} not found in the backup", getName(), quoteString(file_name));
|
ErrorCodes::BACKUP_ENTRY_NOT_FOUND, "Backup {}: Entry {} not found in the backup", backup_name, quoteString(file_name));
|
||||||
return info->size;
|
return info->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +412,7 @@ UInt128 BackupImpl::getFileChecksum(const String & file_name) const
|
|||||||
auto info = coordination->getFileInfo(file_name);
|
auto info = coordination->getFileInfo(file_name);
|
||||||
if (!info)
|
if (!info)
|
||||||
throw Exception(
|
throw Exception(
|
||||||
ErrorCodes::BACKUP_ENTRY_NOT_FOUND, "Backup {}: Entry {} not found in the backup", getName(), quoteString(file_name));
|
ErrorCodes::BACKUP_ENTRY_NOT_FOUND, "Backup {}: Entry {} not found in the backup", backup_name, quoteString(file_name));
|
||||||
return info->checksum;
|
return info->checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ SizeAndChecksum BackupImpl::getFileSizeAndChecksum(const String & file_name) con
|
|||||||
auto info = coordination->getFileInfo(file_name);
|
auto info = coordination->getFileInfo(file_name);
|
||||||
if (!info)
|
if (!info)
|
||||||
throw Exception(
|
throw Exception(
|
||||||
ErrorCodes::BACKUP_ENTRY_NOT_FOUND, "Backup {}: Entry {} not found in the backup", getName(), quoteString(file_name));
|
ErrorCodes::BACKUP_ENTRY_NOT_FOUND, "Backup {}: Entry {} not found in the backup", backup_name, quoteString(file_name));
|
||||||
return std::pair(info->size, info->checksum);
|
return std::pair(info->size, info->checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ BackupEntryPtr BackupImpl::readFile(const SizeAndChecksum & size_and_checksum) c
|
|||||||
auto info_opt = coordination->getFileInfo(size_and_checksum);
|
auto info_opt = coordination->getFileInfo(size_and_checksum);
|
||||||
if (!info_opt)
|
if (!info_opt)
|
||||||
throw Exception(
|
throw Exception(
|
||||||
ErrorCodes::BACKUP_ENTRY_NOT_FOUND, "Backup {}: Entry {} not found in the backup", getName(), formatSizeAndChecksum(size_and_checksum));
|
ErrorCodes::BACKUP_ENTRY_NOT_FOUND, "Backup {}: Entry {} not found in the backup", backup_name, formatSizeAndChecksum(size_and_checksum));
|
||||||
|
|
||||||
const auto & info = *info_opt;
|
const auto & info = *info_opt;
|
||||||
if (!info.size)
|
if (!info.size)
|
||||||
@ -461,7 +461,7 @@ BackupEntryPtr BackupImpl::readFile(const SizeAndChecksum & size_and_checksum) c
|
|||||||
throw Exception(
|
throw Exception(
|
||||||
ErrorCodes::NO_BASE_BACKUP,
|
ErrorCodes::NO_BASE_BACKUP,
|
||||||
"Backup {}: Entry {} is marked to be read from a base backup, but there is no base backup specified",
|
"Backup {}: Entry {} is marked to be read from a base backup, but there is no base backup specified",
|
||||||
getName(), formatSizeAndChecksum(size_and_checksum));
|
backup_name, formatSizeAndChecksum(size_and_checksum));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!base_backup->fileExists(std::pair(info.base_size, info.base_checksum)))
|
if (!base_backup->fileExists(std::pair(info.base_size, info.base_checksum)))
|
||||||
@ -469,7 +469,7 @@ BackupEntryPtr BackupImpl::readFile(const SizeAndChecksum & size_and_checksum) c
|
|||||||
throw Exception(
|
throw Exception(
|
||||||
ErrorCodes::WRONG_BASE_BACKUP,
|
ErrorCodes::WRONG_BASE_BACKUP,
|
||||||
"Backup {}: Entry {} is marked to be read from a base backup, but doesn't exist there",
|
"Backup {}: Entry {} is marked to be read from a base backup, but doesn't exist there",
|
||||||
getName(), formatSizeAndChecksum(size_and_checksum));
|
backup_name, formatSizeAndChecksum(size_and_checksum));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto base_entry = base_backup->readFile(std::pair{info.base_size, info.base_checksum});
|
auto base_entry = base_backup->readFile(std::pair{info.base_size, info.base_checksum});
|
||||||
@ -497,7 +497,7 @@ void BackupImpl::writeFile(const String & file_name, BackupEntryPtr entry)
|
|||||||
|
|
||||||
if (coordination->getFileInfo(file_name))
|
if (coordination->getFileInfo(file_name))
|
||||||
throw Exception(
|
throw Exception(
|
||||||
ErrorCodes::BACKUP_ENTRY_ALREADY_EXISTS, "Backup {}: Entry {} already exists", getName(), quoteString(file_name));
|
ErrorCodes::BACKUP_ENTRY_ALREADY_EXISTS, "Backup {}: Entry {} already exists", backup_name, quoteString(file_name));
|
||||||
|
|
||||||
FileInfo info;
|
FileInfo info;
|
||||||
info.file_name = file_name;
|
info.file_name = file_name;
|
||||||
|
@ -9,7 +9,7 @@ namespace DB
|
|||||||
{
|
{
|
||||||
namespace ErrorCodes
|
namespace ErrorCodes
|
||||||
{
|
{
|
||||||
extern const int UNKNOWN_SETTING;
|
extern const int CANNOT_PARSE_BACKUP_SETTINGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// List of backup settings except base_backup_name.
|
/// List of backup settings except base_backup_name.
|
||||||
@ -44,7 +44,7 @@ BackupSettings BackupSettings::fromBackupQuery(const ASTBackupQuery & query)
|
|||||||
else
|
else
|
||||||
|
|
||||||
LIST_OF_BACKUP_SETTINGS(GET_SETTINGS_FROM_BACKUP_QUERY_HELPER)
|
LIST_OF_BACKUP_SETTINGS(GET_SETTINGS_FROM_BACKUP_QUERY_HELPER)
|
||||||
throw Exception(ErrorCodes::UNKNOWN_SETTING, "Unknown setting {}", setting.name);
|
throw Exception(ErrorCodes::CANNOT_PARSE_BACKUP_SETTINGS, "Unknown setting {}", setting.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ void BackupSettings::copySettingsToBackupQuery(ASTBackupQuery & query) const
|
|||||||
static const BackupSettings default_settings;
|
static const BackupSettings default_settings;
|
||||||
|
|
||||||
#define SET_SETTINGS_IN_BACKUP_QUERY_HELPER(TYPE, NAME) \
|
#define SET_SETTINGS_IN_BACKUP_QUERY_HELPER(TYPE, NAME) \
|
||||||
if (NAME != default_settings.NAME) \
|
if ((NAME) != default_settings.NAME) \
|
||||||
query_settings->changes.emplace_back(#NAME, static_cast<Field>(SettingField##TYPE{NAME}));
|
query_settings->changes.emplace_back(#NAME, static_cast<Field>(SettingField##TYPE{NAME}));
|
||||||
|
|
||||||
LIST_OF_BACKUP_SETTINGS(SET_SETTINGS_IN_BACKUP_QUERY_HELPER)
|
LIST_OF_BACKUP_SETTINGS(SET_SETTINGS_IN_BACKUP_QUERY_HELPER)
|
||||||
|
@ -16,10 +16,7 @@ BackupsWorker & BackupsWorker::instance()
|
|||||||
return the_instance;
|
return the_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
BackupsWorker::BackupsWorker()
|
BackupsWorker::BackupsWorker() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
size_t BackupsWorker::add(const String & backup_name, BackupStatus status, const String & error)
|
size_t BackupsWorker::add(const String & backup_name, BackupStatus status, const String & error)
|
||||||
{
|
{
|
||||||
|
@ -11,8 +11,8 @@ namespace DB
|
|||||||
{
|
{
|
||||||
namespace ErrorCodes
|
namespace ErrorCodes
|
||||||
{
|
{
|
||||||
extern const int UNKNOWN_SETTING;
|
extern const int CANNOT_PARSE_BACKUP_SETTINGS;
|
||||||
extern const int CANNOT_PARSE_RESTORE_TABLE_CREATION_MODE;
|
extern const int LOGICAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -25,7 +25,7 @@ namespace
|
|||||||
{
|
{
|
||||||
if (field.getType() == Field::Types::String)
|
if (field.getType() == Field::Types::String)
|
||||||
{
|
{
|
||||||
String str = field.get<String>();
|
const String & str = field.get<const String &>();
|
||||||
if (str == "1" || boost::iequals(str, "true"))
|
if (str == "1" || boost::iequals(str, "true"))
|
||||||
value = RestoreTableCreationMode::kCreate;
|
value = RestoreTableCreationMode::kCreate;
|
||||||
else if (str == "0" || boost::iequals(str, "false"))
|
else if (str == "0" || boost::iequals(str, "false"))
|
||||||
@ -33,7 +33,7 @@ namespace
|
|||||||
else if (boost::iequals(str, "if not exists"))
|
else if (boost::iequals(str, "if not exists"))
|
||||||
value = RestoreTableCreationMode::kCreateIfNotExists;
|
value = RestoreTableCreationMode::kCreateIfNotExists;
|
||||||
else throw Exception("Cannot parse creation mode from string '" + str + "'",
|
else throw Exception("Cannot parse creation mode from string '" + str + "'",
|
||||||
ErrorCodes::CANNOT_PARSE_RESTORE_TABLE_CREATION_MODE);
|
ErrorCodes::CANNOT_PARSE_BACKUP_SETTINGS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -52,6 +52,7 @@ namespace
|
|||||||
case RestoreTableCreationMode::kMustExist: return Field{false};
|
case RestoreTableCreationMode::kMustExist: return Field{false};
|
||||||
case RestoreTableCreationMode::kCreateIfNotExists: return Field{"if not exists"};
|
case RestoreTableCreationMode::kCreateIfNotExists: return Field{"if not exists"};
|
||||||
}
|
}
|
||||||
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unexpected value of enum RestoreTableCreationMode: {}", static_cast<int>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
operator RestoreTableCreationMode() const { return value; }
|
operator RestoreTableCreationMode() const { return value; }
|
||||||
@ -94,7 +95,7 @@ RestoreSettings RestoreSettings::fromRestoreQuery(const ASTBackupQuery & query)
|
|||||||
else
|
else
|
||||||
|
|
||||||
LIST_OF_RESTORE_SETTINGS(GET_SETTINGS_FROM_RESTORE_QUERY_HELPER)
|
LIST_OF_RESTORE_SETTINGS(GET_SETTINGS_FROM_RESTORE_QUERY_HELPER)
|
||||||
throw Exception(ErrorCodes::UNKNOWN_SETTING, "Unknown setting {}", setting.name);
|
throw Exception(ErrorCodes::CANNOT_PARSE_BACKUP_SETTINGS, "Unknown setting {}", setting.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +112,7 @@ void RestoreSettings::copySettingsToRestoreQuery(ASTBackupQuery & query) const
|
|||||||
static const RestoreSettings default_settings;
|
static const RestoreSettings default_settings;
|
||||||
|
|
||||||
#define SET_SETTINGS_IN_RESTORE_QUERY_HELPER(TYPE, NAME) \
|
#define SET_SETTINGS_IN_RESTORE_QUERY_HELPER(TYPE, NAME) \
|
||||||
if (NAME != default_settings.NAME) \
|
if ((NAME) != default_settings.NAME) \
|
||||||
query_settings->changes.emplace_back(#NAME, static_cast<Field>(SettingField##TYPE{NAME}));
|
query_settings->changes.emplace_back(#NAME, static_cast<Field>(SettingField##TYPE{NAME}));
|
||||||
|
|
||||||
LIST_OF_RESTORE_SETTINGS(SET_SETTINGS_IN_RESTORE_QUERY_HELPER)
|
LIST_OF_RESTORE_SETTINGS(SET_SETTINGS_IN_RESTORE_QUERY_HELPER)
|
||||||
|
@ -22,14 +22,11 @@
|
|||||||
#include <Storages/IStorage.h>
|
#include <Storages/IStorage.h>
|
||||||
#include <base/chrono_io.h>
|
#include <base/chrono_io.h>
|
||||||
#include <base/insertAtEnd.h>
|
#include <base/insertAtEnd.h>
|
||||||
|
#include <base/sleep.h>
|
||||||
#include <boost/range/adaptor/reversed.hpp>
|
#include <boost/range/adaptor/reversed.hpp>
|
||||||
#include <boost/range/algorithm_ext/erase.hpp>
|
#include <boost/range/algorithm_ext/erase.hpp>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
#include <base/sleep.h>
|
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
@ -45,7 +42,7 @@ namespace
|
|||||||
class PathsInBackup
|
class PathsInBackup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PathsInBackup(const IBackup & backup_) : backup(backup_) {}
|
explicit PathsInBackup(const IBackup & backup_) : backup(backup_) {}
|
||||||
|
|
||||||
std::vector<size_t> getShards() const
|
std::vector<size_t> getShards() const
|
||||||
{
|
{
|
||||||
@ -312,10 +309,7 @@ namespace
|
|||||||
|
|
||||||
use_coordination_for_table_creation = true;
|
use_coordination_for_table_creation = true;
|
||||||
replicated_database_zookeeper_path = replicated_db->getZooKeeperPath();
|
replicated_database_zookeeper_path = replicated_db->getZooKeeperPath();
|
||||||
if (restore_coordination->acquireZkPathAndName(replicated_database_zookeeper_path, table_name.second))
|
return restore_coordination->acquireZkPathAndName(replicated_database_zookeeper_path, table_name.second);
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTableCreationResult(IRestoreCoordination::Result res)
|
void setTableCreationResult(IRestoreCoordination::Result res)
|
||||||
|
@ -621,7 +621,7 @@
|
|||||||
M(650, SERIALIZATION_ERROR) \
|
M(650, SERIALIZATION_ERROR) \
|
||||||
M(651, CAPN_PROTO_BAD_TYPE) \
|
M(651, CAPN_PROTO_BAD_TYPE) \
|
||||||
M(652, ONLY_NULLS_WHILE_READING_SCHEMA) \
|
M(652, ONLY_NULLS_WHILE_READING_SCHEMA) \
|
||||||
M(653, CANNOT_PARSE_RESTORE_TABLE_CREATION_MODE) \
|
M(653, CANNOT_PARSE_BACKUP_SETTINGS) \
|
||||||
\
|
\
|
||||||
M(999, KEEPER_EXCEPTION) \
|
M(999, KEEPER_EXCEPTION) \
|
||||||
M(1000, POCO_EXCEPTION) \
|
M(1000, POCO_EXCEPTION) \
|
||||||
|
@ -174,7 +174,7 @@ namespace
|
|||||||
changes.emplace_back("shard_num", params.shard_index);
|
changes.emplace_back("shard_num", params.shard_index);
|
||||||
changes.emplace_back("replica_num", params.replica_index);
|
changes.emplace_back("replica_num", params.replica_index);
|
||||||
|
|
||||||
auto out_settings = std::shared_ptr<ASTSetQuery>();
|
auto out_settings = std::make_shared<ASTSetQuery>();
|
||||||
out_settings->changes = std::move(changes);
|
out_settings->changes = std::move(changes);
|
||||||
out_settings->is_standalone = false;
|
out_settings->is_standalone = false;
|
||||||
return out_settings;
|
return out_settings;
|
||||||
|
Loading…
Reference in New Issue
Block a user